|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Reduction;
-
- use Knp\Component\Pager\PaginatorInterface;
- use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel;
- use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
- use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
- use Lc\SovBundle\Model\User\UserInterface;
- use Lc\SovBundle\Repository\AbstractRepositoryQuery;
-
- class ReductionCreditRepositoryQuery extends AbstractRepositoryQuery
- {
- use SectionRepositoryQueryTrait;
-
- public function __construct(ReductionCreditRepository $repository, PaginatorInterface $paginator)
- {
- parent::__construct($repository, 'r', $paginator);
- }
-
- public function filterByUser(UserInterface $user)
- {
- return $this
- ->andWhere(':user MEMBER OF .users')
- ->setParameter('user', $user);
- }
-
- public function filterByType(string $type = ReductionCreditModel::TYPE_CREDIT)
- {
- return $this
- ->andWhere('.type = :type')
- ->setParameter('type', $type);
- }
- }
|