You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1003B

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Reduction;
  3. use Knp\Component\Pager\PaginatorInterface;
  4. use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel;
  5. use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
  6. use Lc\SovBundle\Model\User\UserInterface;
  7. use Lc\SovBundle\Repository\AbstractRepositoryQuery;
  8. class ReductionCreditRepositoryQuery extends AbstractRepositoryQuery
  9. {
  10. use MerchantRepositoryQueryTrait;
  11. public function __construct(ReductionCreditRepository $repository, PaginatorInterface $paginator)
  12. {
  13. parent::__construct($repository, 'r', $paginator);
  14. }
  15. public function filterByUser(UserInterface $user)
  16. {
  17. return $this
  18. ->andWhere(':user MEMBER OF .users')
  19. ->setParameter('user', $user);
  20. }
  21. public function filterByType(string $type = ReductionCreditModel::TYPE_CREDIT)
  22. {
  23. return $this
  24. ->andWhere('.type = :type')
  25. ->setParameter('type', $type);
  26. }
  27. }