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.

65 line
1.6KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Reminder;
  3. use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
  4. use Lc\CaracoleBundle\Repository\SectionStoreTrait;
  5. use Lc\SovBundle\Model\User\UserInterface;
  6. use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore;
  7. class ReminderStore extends SovReminderStore
  8. {
  9. use SectionStoreTrait;
  10. use MerchantStoreTrait;
  11. public function get($params = [], $query = null)
  12. {
  13. $query = $this->createQuery($query);
  14. if ($this->merchant) {
  15. $query->filterByMerchant($this->merchant);
  16. }
  17. if ($this->section) {
  18. $query->filterBySection($this->section);
  19. }
  20. return parent::get($params, $query);
  21. }
  22. public function getByUser(UserInterface $user, $query = null): array
  23. {
  24. $query = $this->createQuery($query);
  25. if ($this->merchant) {
  26. $query->filterByMerchant($this->merchant);
  27. }
  28. if ($this->section) {
  29. $query->filterBySection($this->section);
  30. }
  31. return parent::getByUser($user, $query);
  32. }
  33. public function getByEasyAdminConfigAndUser(
  34. string $crudAction,
  35. string $crudControllerFqcn,
  36. UserInterface $user,
  37. int $entityId = null,
  38. $query = null
  39. ): array {
  40. $query = $this->createQuery($query);
  41. if ($this->merchant) {
  42. $query->filterByMerchant($this->merchant);
  43. }
  44. if ($this->section) {
  45. $query->filterBySection($this->section);
  46. }
  47. return parent::getByEasyAdminConfigAndUser($crudAction, $crudControllerFqcn, $user, $entityId, $query);
  48. }
  49. }