<?php

namespace Lc\CaracoleBundle\Repository\Distribution;

use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class DistributionRepositoryQuery extends AbstractRepositoryQuery
{
    use SectionRepositoryQueryTrait;

    public function __construct(DistributionRepository $repository, PaginatorInterface $paginator)
    {
        parent::__construct($repository, 'distribution', $paginator);
    }

    public function filterByYear(int $year): self
    {
        return $this
            ->andWhere('.year = :year')
            ->setParameter('year', $year);
    }

    public function filterByCycleNumber(int $cycleNumber): self
    {
        return $this
                ->andWhere('.cycleNumber = :cycleNumber')
                ->setParameter('cycleNumber', $cycleNumber);
    }
    public function filterByCycleType(string $cycleType): self
    {
        return $this
            ->andWhere('.cycleType = :cycleType')
            ->setParameter('cycleType', $cycleType);
    }
}