本文整理汇总了PHP中Repository::findBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::findBy方法的具体用法?PHP Repository::findBy怎么用?PHP Repository::findBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::findBy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAll
/**
* Get all projects
*
* @return array ?
*/
public function getAll($budget)
{
$this->_validateBudget($budget);
$projects = $this->repo->findBy(array('budget' => $budget), array('name' => 'ASC'));
$this->_loadOwnerObjects($projects);
return $projects;
}
示例2: getAll
/**
* Get all SubProjects
*
* @return array ?
*/
public function getAll($project, $allocatedAmountData = false)
{
$this->_validateProject($project);
$subProjects = $this->repo->findBy(array('project' => $project->getId()), array('name' => 'ASC'));
if ($allocatedAmountData !== false) {
$this->_loadAllocatedAmounts($subProjects, $allocatedAmountData);
}
return $subProjects;
}
示例3: findBy
/**
* @param array $criteria
* @param array|null $orderBy
* @param integer|null $limit
* @param integer|null $offset
* @return array|null
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
{
$cache = $this->em->getCache();
$cacheKey = $this->className . ':';
if ($criteria) {
$cacheKey .= implode(',', $criteria);
}
if ($orderBy) {
$cacheKey .= implode(',', $orderBy);
}
if ($limit) {
$cacheKey .= $limit;
}
if ($offset) {
$cacheKey .= $offset;
}
if ($cache->contains($cacheKey)) {
return $cache->fetch($cacheKey);
}
$result = parent::findBy($criteria, $orderBy, $limit, $offset);
if ($result) {
$cache->save($cacheKey, $result, 60 * 10);
}
return $result;
}
示例4: getAll
/**
* Get all Transaction
*
* @return array ?
*/
public function getAll($subProject)
{
$this->_validateSubProject($subProject);
$transactions = $this->repo->findBy(array('subProject' => $subProject->getId()), array('name' => 'ASC'));
return $transactions;
}
示例5: getAll
/**
* Get all budgets
*
* @return array
*/
public function getAll()
{
$budgets = $this->repo->findBy(array(), array('name' => 'ASC'));
$this->_loadOwnerObjects($budgets);
return $budgets;
}