Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

82 lines
2.4KB

  1. <?php
  2. namespace Lc\SovBundle\Repository\Reminder;
  3. use Lc\SovBundle\Repository\AbstractStore;
  4. class ReminderStore extends AbstractStore implements ReminderStoreInterface
  5. {
  6. protected ReminderRepositoryQueryInterface $query;
  7. public function __construct(ReminderRepositoryQueryInterface $query)
  8. {
  9. $this->query = $query;
  10. }
  11. public function get($params = [], $query = null)
  12. {
  13. if(is_null($query)) {
  14. $query = $this->query->create();
  15. }
  16. $query->filterDone();
  17. if(array_key_exists('user', $params)) {
  18. $query->filterUser($params['user']);
  19. }
  20. if(array_key_exists('crudAction', $params)) {
  21. $query->filterCrudAction($params['crudAction']);
  22. }
  23. if(array_key_exists('crudControllerFqcn', $params)) {
  24. $query->filterCrudControllerFqcn($params['crudControllerFqcn']);
  25. }
  26. if(array_key_exists('entityId', $params)) {
  27. $query->filterEntityId($params['entityId']);
  28. }
  29. $query->orderDefault();
  30. return $query->find();
  31. }
  32. /*
  33. public function findByUser($user)
  34. {
  35. $qb = $this->createQueryBuilder('e')
  36. ->leftJoin('e.users', 'u')
  37. ->having('COUNT(u.id) = 0')
  38. ->orHaving(':user MEMBER OF e.users')
  39. ->andWhere('e.done = 0')
  40. ->setParameter('user', $user)
  41. ->orderBy('e.dateReminder', 'ASC')
  42. ->groupBy('e.id');
  43. return $qb->getQuery()->getResult();
  44. }
  45. public function findByEasyAdminConfigAndUser($crudAction, $crudControllerFqcn, $user, $entityId = null)
  46. {
  47. $qb = $this->createQueryBuilder('e');
  48. $qb->leftJoin('e.users', 'u');
  49. $qb->having('COUNT(u.id) = 0');
  50. $qb->orHaving(':user MEMBER OF e.users');
  51. $qb->andWhere('e.done = 0');
  52. $qb->andWhere('e.crudAction LIKE :crudAction');
  53. $qb->andWhere('e.crudControllerFqcn LIKE :entity');
  54. $qb->setParameter('crudAction', $crudAction);
  55. $qb->setParameter('crudControllerFqcn', $crudControllerFqcn);
  56. $qb->setParameter('user', $user);
  57. if ($entityId) {
  58. $qb->andWhere('e.entityId LIKE :id');
  59. $qb->setParameter('entityId', $entityId);
  60. }
  61. $qb->orderBy('e.dateReminder', 'ASC');
  62. $qb->groupBy('e.id');
  63. return $qb->getQuery()->getResult();
  64. }*/
  65. }