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 domain\Product\Product;
-
- use domain\Distribution\Distribution\Distribution;
- use domain\Product\ProductCategory\ProductCategory;
- use domain\_\AbstractRepositoryQuery;
-
- class ProductRepositoryQuery extends AbstractRepositoryQuery
- {
- protected ProductDefinition $definition;
-
- public function loadDependencies(): void
- {
- $this->loadDefinition(ProductDefinition::class);
- }
-
- public function filterByName(string $name): self
- {
- $this->andWhere(['name' => $name]);
- return $this;
- }
-
- public function filterByDistribution(Distribution $distribution): self
- {
- $this->andWhere(['product_distribution.id_distribution' => $distribution->id]);
- return $this;
- }
-
- public function filterByProductCategory(ProductCategory $productCategory = null) : self
- {
- if($productCategory) {
- $this->andWhere(['product.id_product_category' => $productCategory->id]);
- }
- return $this;
- }
- }
|