38 lines
1.1KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Distribution;
  3. use Knp\Component\Pager\PaginatorInterface;
  4. use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
  5. use Lc\SovBundle\Repository\AbstractRepositoryQuery;
  6. class DistributionRepositoryQuery extends AbstractRepositoryQuery
  7. {
  8. use SectionRepositoryQueryTrait;
  9. public function __construct(DistributionRepository $repository, PaginatorInterface $paginator)
  10. {
  11. parent::__construct($repository, 'distribution', $paginator);
  12. }
  13. public function filterByYear(int $year): self
  14. {
  15. return $this
  16. ->andWhere('.year = :year')
  17. ->setParameter('year', $year);
  18. }
  19. public function filterByCycleNumber(int $cycleNumber): self
  20. {
  21. return $this
  22. ->andWhere('.cycleNumber = :cycleNumber')
  23. ->setParameter('cycleNumber', $cycleNumber);
  24. }
  25. public function filterByCycleType(string $cycleType): self
  26. {
  27. return $this
  28. ->andWhere('.cycleType = :cycleType')
  29. ->setParameter('cycleType', $cycleType);
  30. }
  31. }