|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Distribution;
-
- use App\Entity\Distribution\Distribution;
- use Lc\CaracoleBundle\Repository\AbstractStore;;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class DistributionStore extends AbstractStore
- {
- protected DistributionRepositoryQuery $query;
-
- public function __construct(DistributionRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function getOneByCycleNumberYearAndCycleType(
- int $cycleNumber,
- int $year,
- string $cycleType
- ): ?Distribution {
- $query = $this->createQuery();
- $query->filterByCycleNumber($cycleNumber);
- $query->filterByYear($year);
- $query->filterByCycleType($cycleType);
-
- return $query->findOne();
- }
-
- }
|