[英]Getting as an array rather than a DataMapper ORM collection object
I am using the DataMapper ORM in my CodeIgniter project. 我在CodeIgniter项目中使用DataMapper ORM 。
The problem I am having is, when I use the following codes: 我遇到的问题是,当我使用以下代码时:
$o = new Object();
$o->get();
The $o
becomes a DataMapper ORM collection object rather than an array. $o
成为DataMapper ORM集合对象而不是数组。
I know I can still use foreach
to loop through the collection but other PHP array functions (such as array_pop
, array_splice
) still can not be used on it. 我知道我仍然可以使用
foreach
循环遍历集合,但其他PHP数组函数(例如array_pop
, array_splice
)仍然无法在其上使用。
I would like to know if there is any function provided by DataMapper ORM to return it as an array. 我想知道DataMapper ORM是否提供了任何函数来将其作为数组返回。
Many thanks to you all. 非常感谢大家。
使用DataMapper的$o->all
属性而不是$o->get()
方法返回一个数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.