本文整理匯總了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;
}