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.

ReductionCreditRepositoryQuery.php 1.0KB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334
  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\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
  7. use Lc\SovBundle\Model\User\UserInterface;
  8. use Lc\SovBundle\Repository\AbstractRepositoryQuery;
  9. class ReductionCreditRepositoryQuery extends AbstractRepositoryQuery
  10. {
  11. use SectionRepositoryQueryTrait;
  12. public function __construct(ReductionCreditRepository $repository, PaginatorInterface $paginator)
  13. {
  14. parent::__construct($repository, 'r', $paginator);
  15. }
  16. public function filterByUser(UserInterface $user)
  17. {
  18. return $this
  19. ->andWhere(':user MEMBER OF .users')
  20. ->setParameter('user', $user);
  21. }
  22. public function filterByType(string $type = ReductionCreditModel::TYPE_CREDIT)
  23. {
  24. return $this
  25. ->andWhere('.type = :type')
  26. ->setParameter('type', $type);
  27. }
  28. }