You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ReminderRepositoryQuery.php 912B

3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637
  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. }