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.

46 lines
1023B

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Reminder;
  3. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  4. use Lc\CaracoleBundle\Model\Section\SectionInterface;
  5. use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore;
  6. class ReminderStore extends SovReminderStore
  7. {
  8. protected MerchantInterface $merchant;
  9. protected SectionInterface $section;
  10. public function setMerchant(MerchantInterface $merchant)
  11. {
  12. $this->merchant = $merchant;
  13. return $this;
  14. }
  15. public function setSection(SectionInterface $section)
  16. {
  17. $this->section = $section;
  18. return $this;
  19. }
  20. public function get($params = [], $query = null)
  21. {
  22. if(is_null($query)) {
  23. $query = $this->query->create();
  24. }
  25. if($this->merchant) {
  26. $query->filterByMerchant($this->merchant);
  27. }
  28. if($this->section) {
  29. $query->filterBySection($this->section);
  30. }
  31. return parent::get($params, $query);
  32. }
  33. }