|
- <?php
-
- namespace Lc\SovBundle\Repository\Reminder;
-
- use Knp\Component\Pager\PaginatorInterface;
- use Lc\SovBundle\Repository\AbstractRepositoryQuery;
-
- class ReminderRepositoryQuery extends AbstractRepositoryQuery
- {
- public function __construct(ReminderRepositoryInterface $repository, PaginatorInterface $paginator)
- {
- parent::__construct($repository, 'r', $paginator);
- }
-
- public function filterDone()
- {
- return $this
- ->andWhere('.done = 0');
- }
-
- public function filterUser($user)
- {
- return $this
- ->leftJoin('.users', 'u')
- ->having('COUNT(u.id) = 0')
- ->orHaving(':user MEMBER OF .users')
- ->setParameter(':user', $user)
- ->groupBy('.id');
- }
-
- public function orderDefault()
- {
- return $this
- ->orderBy('.dateReminder', 'ASC');
- }
-
- }
|