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.
|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Product;
-
- use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface;
- use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
- use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\CaracoleBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class ProductCategoryStore extends AbstractStore
- {
- use SectionStoreTrait;
- use MerchantStoreTrait;
-
- protected ProductCategoryRepositoryQuery $query;
-
- public function __construct(ProductCategoryRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->addOrderBy('.parent')->addOrderBy('.position');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->filterIsOnlineAndOffline();
- $this->addFilterBySectionOptionnal($query);
- $this->addFilterByMerchantViaSectionOptionnal($query);
- return $query;
- }
-
- public function relationsDefault($query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function getOneParent(): ?ProductCategoryInterface
- {
- $query = $this->createDefaultQuery();
- $query->filterIsParent();
- return $query->findOne();
- }
-
- public function getByDevAlias(string $devAlias): array
- {
- $query = $this->createDefaultQuery();
- $query->filterByDevAlias($devAlias);
- return $query->find();
- }
-
- public function getOneByTitle(string $title): ?ProductCategoryInterface
- {
- $query = $this->createDefaultQuery();
- $query->filterByTitle($title);
- return $query->findOne();
- }
- }
|