本文整理汇总了PHP中DataObjectCollection::setParams方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObjectCollection::setParams方法的具体用法?PHP DataObjectCollection::setParams怎么用?PHP DataObjectCollection::setParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectCollection
的用法示例。
在下文中一共展示了DataObjectCollection::setParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: populate
function populate()
{
$po_obj = new DataObject('po_no_auth_user');
$po_obj->idField = 'id';
$po_obj->identifierField = 'order_number';
$po_col = new DataObjectCollection($po_obj);
$po_col->setParams();
$sh = new SearchHandler($po_col, false);
$sh->setFields(array('id', 'order_number', 'supplier', 'status'));
$sh->addConstraint(new Constraint('status', '!=', 'X'));
$this->setSearchLimit($sh);
$sh->setOrderby(array('order_date', 'due_date', 'order_number'));
$po_col->load($sh);
$this->contents = $po_col;
}
示例2: index
public function index(DataObjectCollection $collection, $sh = '', &$c_query = null)
{
showtime('start-controller-index');
$collection->setParams();
if (!$sh instanceof SearchHandler) {
$sh = $this->setSearchHandler($collection);
}
showtime('sh-extracted');
if (isset($this->search) && !isset($this->_data['orderby']) && !isset($this->_data['page'])) {
$cc = $this->search->toConstraintChain();
$sh->addConstraintChain($cc);
$sh->save();
// cache the search string
$search_string_array = array('fop' => $this->search->toString('fop'), 'html' => $this->search->toString('html'));
$_SESSION['search_strings'][EGS_USERNAME][$sh->search_id] = $search_string_array;
}
// Need to set the orderby of the collection in the searchhandler?
// But if this is set in the collection, seems to take it
// so why not here?
showtime('pre-load');
$collection->load($sh, $c_query);
$this->view->set('total_records', $collection->total_records);
$this->view->set('num_records', $collection->num_records);
$this->view->set('num_pages', $collection->num_pages);
$this->view->set('cur_page', $collection->cur_page);
showtime('post-load');
$this->view->set(strtolower($collection->getModelName()) . 's', $collection);
if (isset($this->_data['json'])) {
$this->view->set('echo', $collection->toJSON());
}
if ($this->_templateName === false) {
$this->_templateName = $this->getTemplateName('index');
}
showtime('end-controller-index');
}