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.

ProductAccessoryRepositoryQuery.php 767B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace domain\Product\ProductAccessory;
  3. use domain\_\AbstractRepositoryQuery;
  4. use domain\Product\Accessory\Accessory;
  5. use domain\Product\Product\Product;
  6. class ProductAccessoryRepositoryQuery extends AbstractRepositoryQuery
  7. {
  8. protected ProductAccessoryDefinition $definition;
  9. public function loadDependencies(): void
  10. {
  11. $this->loadDefinition(ProductAccessoryDefinition::class);
  12. }
  13. public function filterByProduct(Product $product): self
  14. {
  15. $this->andWhere(['product_accessory.id_product' => $product->id]);
  16. return $this;
  17. }
  18. public function filterByAccessory(Accessory $accessory): self
  19. {
  20. $this->andWhere(['product_accessory.id_accessory' => $accessory->id]);
  21. return $this;
  22. }
  23. }