class ORM 的对象无法使用 Idiorm 转换为字符串

Object of class ORM could not be converted to string Using Idiorm

我想显示特定日期最后插入行中的字段 (bal)。

$BALdata171201 = ORM::for_table('sys_transactions')->where('date',$data171201)->select('bal')->order_by_desc('id')->limit(1)

但我一直收到错误消息:

可捕获的致命错误:class ORM 的对象无法转换为字符串

如何将 ORM 对象转换为字符串?

我已经阅读了很多关于这个问题的答案,但我没有找到任何解决方案。

如果我使用 var_dump 我得到:

object(IdiormResultSet)#132 (1) {
  ["_results":protected]=>
  array(1) {
    [0]=>
    object(ORM)#131 (22) {
      ["_connection_name":protected]=>
      string(7) "default"
      ["_table_name":protected]=>
      string(16) "sys_transactions"
      ["_table_alias":protected]=>
      NULL
      ["_values":protected]=>
      array(0) {
      }
      ["_result_columns":protected]=>
      array(1) {
        [0]=>
        string(1) "*"
      }
      ["_using_default_result_columns":protected]=>
      bool(true)
      ["_join_sources":protected]=>
      array(0) {
      }
      ["_distinct":protected]=>
      bool(false)
      ["_is_raw_query":protected]=>
      bool(false)
      ["_raw_query":protected]=>
      string(0) ""
      ["_raw_parameters":protected]=>
      array(0) {
      }
      ["_where_conditions":protected]=>
      array(0) {
      }
      ["_limit":protected]=>
      NULL
      ["_offset":protected]=>
      NULL
      ["_order_by":protected]=>
      array(0) {
      }
      ["_group_by":protected]=>
      array(0) {
      }
      ["_having_conditions":protected]=>
      array(0) {
      }
      ["_data":protected]=>
      array(1) {
        ["bal"]=>
        string(7) "1354.00"
      }
      ["_dirty_fields":protected]=>
      array(0) {
      }
      ["_expr_fields":protected]=>
      array(0) {
      }
      ["_is_new":protected]=>
      bool(false)
      ["_instance_id_column":protected]=>
      NULL
    }
  }
}

我已经试过 $BALdata171201string = $BALdata171201string->_data; 但是我得到一个空回声。

我的问题已经解决了。

在前端,我使用以下方式调用: {$BALdata171201}

现在我正在使用:

{foreach $BALdata171201 as $b01s} <b>Balanço</b></br>R$ {$b01s['bal']}{/foreach}

工作起来很有魅力。