|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Reduction;
-
- use Knp\Component\Pager\PaginatorInterface;
- use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
- use Lc\SovBundle\Model\User\UserInterface;
- use Lc\SovBundle\Repository\AbstractRepositoryQuery;
-
- class ReductionCartRepositoryQuery extends AbstractRepositoryQuery
- {
- use MerchantRepositoryQueryTrait;
-
- public function __construct(ReductionCartRepository $repository, PaginatorInterface $paginator)
- {
- parent::__construct($repository, 'reductionCart', $paginator);
- }
-
- public function filterByCode(string $code)
- {
- return $this
- ->andWhere('.codes LIKE :code')
- ->setParameter('code', '%'.$code.'%') ;
- }
-
- public function filterByUser(UserInterface $user)
- {
- return $this
- ->andWhere(':user MEMBER OF .users')
- ->setParameter('user', $user);
- }
-
- public function filterByType(string $type, string $operator = '=')
- {
- return $this
- ->andWhere('.type '.$operator.' :type')
- ->setParameter('type', $type);
- }
- }
|