|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Reduction;
-
- use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\SovBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class ReductionCatalogStore extends AbstractStore
- {
- use SectionStoreTrait;
-
- protected ReductionCatalogRepositoryQuery $query;
-
- public function __construct(ReductionCatalogRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- if($this->section) {
- $query->filterBySection($this->section);
- }
- $query->filterIsOnlineAndOffline();
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
-
- public function getByProductFamily(ProductFamilyInterface $productFamily, $query = null)
- {
- $query = $this->createDefaultQuery($query);
-
- $query
- ->filterProductFamily($productFamily);
-
- return $query->findOne();
- }
- }
|