|
12345678910111213141516171819202122232425262728293031323334 |
- <?php
-
- namespace domain\Product\RotatingProduct;
-
- use domain\_\AbstractRepository;
- use domain\Product\Rotating\Rotating;
-
- class RotatingProductRepository extends AbstractRepository
- {
- protected RotatingProductRepositoryQuery $query;
-
- public function loadDependencies(): void
- {
- $this->loadQuery(RotatingProductRepositoryQuery::class);
- }
-
- public function getDefaultOptionsSearch(): array
- {
- return [
- self::WITH => [],
- self::JOIN_WITH => [],
- self::ORDER_BY => 'rotating_product.position ASC',
- self::ATTRIBUTE_ID_PRODUCER => ''
- ];
- }
-
- public function findOneLastRotatingProduct(Rotating $rotating): ?RotatingProduct
- {
- return $this->createQuery()
- ->filterByRotating($rotating)
- ->orderBy('rotating_product.position DESC')
- ->findOne();
- }
- }
|