Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

38 lines
912B

  1. <?php
  2. namespace Lc\SovBundle\Repository\Reminder;
  3. use Knp\Component\Pager\PaginatorInterface;
  4. use Lc\SovBundle\Repository\AbstractRepositoryQuery;
  5. class ReminderRepositoryQuery extends AbstractRepositoryQuery
  6. {
  7. public function __construct(ReminderRepositoryInterface $repository, PaginatorInterface $paginator)
  8. {
  9. parent::__construct($repository, 'r', $paginator);
  10. }
  11. public function filterDone()
  12. {
  13. return $this
  14. ->andWhere('.done = 0');
  15. }
  16. public function filterUser($user)
  17. {
  18. return $this
  19. ->leftJoin('.users', 'u')
  20. ->having('COUNT(u.id) = 0')
  21. ->orHaving(':user MEMBER OF .users')
  22. ->setParameter(':user', $user)
  23. ->groupBy('.id');
  24. }
  25. public function orderDefault()
  26. {
  27. return $this
  28. ->orderBy('.dateReminder', 'ASC');
  29. }
  30. }