【发布时间】:2012-03-06 17:14:14
【问题描述】:
假设数据库中三个表之间的关联如下:
//working with three tables a client 'has one' business
//and a business has many business hours.
以下将为我们提供一个 Activerecord 对象数组:
$this->client->business->businesshours
我们必须从数组中拉出一个对象来获取它的列值:
$this->client->business->businesshours[0]->start_time
由于我是 PHP Activerecord 的新手,除了使用 foreach() 循环进行循环之外,还有哪些方法可以从对象数组中提取/排序/使用信息?是否有方法对对象数组进行排序、根据列值提取信息、任何最佳实践?
【问题讨论】:
标签: php arrays object activerecord phpactiverecord