Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ProductFamilySectionPropertyStore.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Product;
  3. use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
  4. use Lc\CaracoleBundle\Repository\SectionStoreTrait;
  5. use Lc\CaracoleBundle\Repository\AbstractStore;
  6. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  7. class ProductFamilySectionPropertyStore extends AbstractStore
  8. {
  9. use SectionStoreTrait;
  10. protected ProductFamilySectionPropertyRepositoryQuery $query;
  11. public function __construct(ProductFamilySectionPropertyRepositoryQuery $query)
  12. {
  13. $this->query = $query;
  14. }
  15. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  16. {
  17. return $query;
  18. }
  19. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  20. {
  21. $this->addFilterBySectionRequired($query);
  22. return $query;
  23. }
  24. public function relationsDefault($query): RepositoryQueryInterface
  25. {
  26. return $query;
  27. }
  28. public function getOneByProductFamily(ProductFamilyInterface $productFamily, $query = null)
  29. {
  30. $query = $this->createDefaultQuery($query);
  31. $query->filterByProductFamily($productFamily);
  32. return $query->findOne();
  33. }
  34. }