add counter for tasks

This commit is contained in:
2018-04-27 22:21:11 +02:00
parent 3719ce0896
commit 654a5a2019
3 changed files with 74 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ class SingleTaskRepository extends \Doctrine\ORM\EntityRepository
* @param User $currentUser
* @return int
*/
public function countByParameters($params, User $currentUser)
public function countByParameters($params, User $currentUser = null)
{
$qb = $this->createQueryBuilder('st')
->select('COUNT(st)');
@@ -97,9 +97,11 @@ class SingleTaskRepository extends \Doctrine\ORM\EntityRepository
;
}
protected function buildQuery(QueryBuilder $qb, $params, User $currentUser)
protected function buildQuery(QueryBuilder $qb, $params, User $currentUser = null)
{
$this->buildACLQuery($qb, $currentUser);
if (NULL !== $currentUser) {
$this->buildACLQuery($qb, $currentUser);
}
if (\array_key_exists('person', $params) and !empty($params['person'])) {
$qb->andWhere($qb->expr()->eq('st.person', ':person'));