|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Product;
-
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\SovBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class ProductStore extends AbstractStore
- {
- use SectionStoreTrait;
-
- protected ProductRepositoryQuery $query;
-
- public function __construct(ProductRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query) :RepositoryQueryInterface
- {
- return $query;
- }
-
- public function filtersDefault($query):RepositoryQueryInterface
- {
- $query->filterIsOnlineAndOffline();
- $query->filterBySection($this->section);
- return $query;
- }
-
- public function relationsDefault($query):RepositoryQueryInterface
- {
- return $query->joinProductFamily();
- }
-
- //findProductByAvailabilitiesNegative
- public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array
- {
- $query = $this->createDefaultQuery($query);
- $query->filterIsOnline();
- $query->filterBehaviorCountStock();
- $query->groupBy('pf.id');
- return $query->find();
- }
-
-
- }
|