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.

AddressStore.php 1.1KB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Address;
  3. use Lc\CaracoleBundle\Repository\AbstractStore;
  4. use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
  5. use Lc\SovBundle\Model\User\UserInterface;
  6. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  7. class AddressStore extends AbstractStore
  8. {
  9. use MerchantStoreTrait;
  10. protected AddressRepositoryQuery $query;
  11. public function __construct(AddressRepositoryQuery $query)
  12. {
  13. $this->query = $query;
  14. }
  15. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  16. {
  17. $query->orderBy('id');
  18. return $query;
  19. }
  20. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  21. {
  22. $query->filterIsOnlineAndOffline();
  23. return $query;
  24. }
  25. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  26. {
  27. return $query;
  28. }
  29. public function getByUser(UserInterface $user)
  30. {
  31. $query = $this->createDefaultQuery();
  32. $query->filterByUser($user);
  33. return $query->find();
  34. }
  35. }