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.

41 lines
1.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Newsletter;
  3. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  4. use Lc\CaracoleBundle\Repository\SectionStoreTrait;
  5. use Lc\CaracoleBundle\Repository\StoreTrait;
  6. use Lc\SovBundle\Repository\Newsletter\NewsletterStore as SovNewsletterStore;
  7. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  8. class NewsletterStore extends SovNewsletterStore
  9. {
  10. use StoreTrait;
  11. use SectionStoreTrait;
  12. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  13. {
  14. $query->orderBy('position');
  15. return $query;
  16. }
  17. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  18. {
  19. $this->addFilterBySectionOptionnal($query);
  20. $query->filterIsOnlineAndOffline();
  21. return $query;
  22. }
  23. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  24. {
  25. return $query;
  26. }
  27. public function getByMerchant(MerchantInterface $merchant, RepositoryQueryInterface $query = null):array
  28. {
  29. $query = $this->createQuery($query);
  30. $query->filterByMerchantViaSection($merchant);
  31. return $query->find();
  32. }
  33. }