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 2.1KB

3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 implements ReminderRepositoryQueryInterface
  6. {
  7. public function __construct(ReminderRepository $repository, PaginatorInterface $paginator)
  8. {
  9. parent::__construct($repository, 'r', $paginator);
  10. }
  11. public function filterDone($done = false)
  12. {
  13. return $this
  14. ->andWhere('.done = :done')
  15. ->setParameter(':done', $done);
  16. }
  17. public function filterUser($user)
  18. {
  19. return $this
  20. ->leftJoin('.users', 'u')
  21. ->having('COUNT(u.id) = 0')
  22. ->orHaving(':user MEMBER OF .users')
  23. ->setParameter(':user', $user)
  24. ->groupBy('.id');
  25. }
  26. public function filterCrudAction($crudAction)
  27. {
  28. if(is_null($crudAction)) {
  29. return $this
  30. ->andWhere('.crudControllerFqcn IS NULL');
  31. }
  32. else {
  33. return $this
  34. ->andWhere('.crudAction = :crudAction')
  35. ->setParameter(':crudAction', $crudAction);
  36. }
  37. }
  38. public function filterCrudControllerFqcn($crudControllerFqcn)
  39. {
  40. if(is_null($crudControllerFqcn)) {
  41. return $this
  42. ->andWhere('.crudControllerFqcn IS NULL');
  43. }
  44. else {
  45. return $this
  46. ->andWhere('.crudControllerFqcn = :crudControllerFqcn')
  47. ->setParameter(':crudControllerFqcn', $crudControllerFqcn);
  48. }
  49. }
  50. public function filterEntityId($entityId)
  51. {
  52. if(is_null($entityId)) {
  53. return $this
  54. ->andWhere('.entityId IS NULL');
  55. }
  56. else {
  57. return $this
  58. ->andWhere('.entityId = :entityId')
  59. ->setParameter(':entityId', $entityId);
  60. }
  61. }
  62. public function orderDefault()
  63. {
  64. return $this
  65. ->orderBy('.dateReminder', 'ASC');
  66. }
  67. }