|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Product;
-
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\CaracoleBundle\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
- {
- $this->addFilterBySectionOptionnal($query);
- $query->filterIsOnlineAndOffline();
-
- return $query;
- }
-
- public function relationsDefault($query):RepositoryQueryInterface
- {
- return $query->joinProductFamily();
- }
-
- //findProductByAvailabilitiesNegative
- public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array
- {
- $query = $this->createQuery($query);
- $query->joinProductFamily();
- $query->filterIsOnline();
- $query->filterBehaviorCountStock();
- $query->groupBy('pf.id');
- return $query->find();
- }
-
-
- }
|