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.

63 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. if (is_null($query)) {
  14. $query = $this->query->create();
  15. }
  16. if ($this->merchant) {
  17. $query->filterByMerchant($this->merchant);
  18. }
  19. if ($this->section) {
  20. $query->filterBySection($this->section);
  21. }
  22. return parent::get($params, $query);
  23. }
  24. public function getByUser(UserInterface $user, $query = null): array
  25. {
  26. if (is_null($query)) {
  27. $query = $this->query->create();
  28. }
  29. if ($this->merchant) {
  30. $query->filterByMerchant($this->merchant);
  31. }
  32. return parent::getByUser($user, $query);
  33. }
  34. public function getByEasyAdminConfigAndUser(
  35. string $crudAction,
  36. string $crudControllerFqcn,
  37. UserInterface $user,
  38. int $entityId = null,
  39. $query = null
  40. ): array {
  41. if (is_null($query)) {
  42. $query = $this->query->create();
  43. }
  44. if ($this->merchant) {
  45. $query->filterByMerchant($this->merchant);
  46. }
  47. return parent::getByEasyAdminConfigAndUser($crudAction, $crudControllerFqcn, $user, $entityId, $query);
  48. }
  49. }