本文整理汇总了PHP中AppModel::FindAll方法的典型用法代码示例。如果您正苦于以下问题:PHP AppModel::FindAll方法的具体用法?PHP AppModel::FindAll怎么用?PHP AppModel::FindAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppModel
的用法示例。
在下文中一共展示了AppModel::FindAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_index
public function admin_index()
{
// ajax?
if ($this->is_ajax) {
// page?
$page = $this->assign('page', (int) Url::GetRequest('page', 1));
// limit
$limit = 10;
$offset = ($page - 1) * $limit;
// page count
$page_count = $this->assign('page_count', ceil(count(AppModel::FindAllSearched(Url::$data['modelName'], Url::GetRequest('search', null), false, $this->filter->where)) / $limit));
// items
$this->assign('items', AppModel::FindAllSearched(Url::$data['modelName'], Url::GetRequest('search', null), false, $this->filter->where, null, $limit, $offset));
} else {
// items
$this->assign('items', AppModel::FindAll(Url::$data['modelName'], false, $this->filter->where, '`' . $this->Model->name_fields[0] . '` ASC'));
}
// options
$this->assign('is_publishable', $this->Model->is_publishable());
}
示例2: _handle_attachments
private function _handle_attachments()
{
if (!$this->do_handle_attachments) {
return true;
}
// cycle Associations
foreach ($this->get_attached as $class) {
// save passed
$tmp = isset($this->{$class}) ? $this->{$class} : array();
// get all objects
$Objects = AppModel::FindAll($class, false);
// only one query
// detach
foreach ($this->find_attached($class) as $Object) {
$this->detach($Object);
}
// attach
if (!empty($tmp)) {
foreach ($tmp as $objectOrId) {
$Object = is_numeric($objectOrId) ? $Objects[$objectOrId] : $objectOrId;
$this->attach($Object);
}
} else {
$this->{$class} = array();
}
}
return true;
}