本文整理汇总了PHP中Dao::findByCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP Dao::findByCriteria方法的具体用法?PHP Dao::findByCriteria怎么用?PHP Dao::findByCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dao
的用法示例。
在下文中一共展示了Dao::findByCriteria方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findByCriteria
/**
* Get a set of results that match a particular where clause
*
* @param string $criteria The search criteria string
* @param array $params The parameters of the query to replace '?'(without the quotes)
* @param array $orderByParams The order clause Array[Entity.Field] = 'direction'
*
* @return array
*/
public function findByCriteria($criteria, array $params = array(), $searchActiveOnly = true, $pageNumber = null, $pageSize = DaoQuery::DEFAUTL_PAGE_SIZE, array $orderByParams = array())
{
$results = Dao::findByCriteria($this->_query->setSelectActiveOnly($searchActiveOnly), $criteria, $params, $pageNumber, $pageSize, $orderByParams);
$this->_pageStats = Dao::getPageStats();
$this->resetQuery();
return $results;
}
示例2: loadManyToMany
/**
* Lazy load a many-to-many relationship
*
* @param string $property The property that we are trying to load
*
* @return BaseEntityAbstract
*/
protected function loadManyToMany($property)
{
// Grab the DaoMap data for both ends of the join
$this->__loadDaoMap();
$cls = DaoMap::$map[strtolower(get_class($this))][$property]['class'];
$obj = new $cls();
$obj->__loadDaoMap();
$thisClass = get_class($this);
$qry = new DaoQuery($cls);
$qry->eagerLoad($cls . '.' . strtolower(substr($thisClass, 0, 1)) . substr($thisClass, 1) . 's');
// Load this end with an array of entities typed to the other end
DaoMap::loadMap($cls);
$alias = DaoMap::$map[strtolower($cls)]['_']['alias'];
$field = strtolower(substr($thisClass, 0, 1)) . substr($thisClass, 1);
$this->{$property} = Dao::findByCriteria($qry, sprintf('`%sId`=?', $field), array($this->getId()));
return $this;
}