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.

RotatingProductRepository.php 885B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace domain\Product\RotatingProduct;
  3. use domain\_\AbstractRepository;
  4. use domain\Product\Rotating\Rotating;
  5. class RotatingProductRepository extends AbstractRepository
  6. {
  7. protected RotatingProductRepositoryQuery $query;
  8. public function loadDependencies(): void
  9. {
  10. $this->loadQuery(RotatingProductRepositoryQuery::class);
  11. }
  12. public function getDefaultOptionsSearch(): array
  13. {
  14. return [
  15. self::WITH => [],
  16. self::JOIN_WITH => [],
  17. self::ORDER_BY => 'rotating_product.position ASC',
  18. self::ATTRIBUTE_ID_PRODUCER => ''
  19. ];
  20. }
  21. public function findOneLastRotatingProduct(Rotating $rotating): ?RotatingProduct
  22. {
  23. return $this->createQuery()
  24. ->filterByRotating($rotating)
  25. ->orderBy('rotating_product.position DESC')
  26. ->findOne();
  27. }
  28. }