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.

39 line
1.1KB

  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 filterStatusOnline()
  16. {
  17. return $this->andWhere('.status = 1');
  18. }
  19. public function filterByUser(UserInterface $user)
  20. {
  21. return $this
  22. ->andWhere(':user MEMBER OF .users')
  23. ->setParameter('user', $user);
  24. }
  25. public function filterByType(string $type = ReductionCreditModel::TYPE_CREDIT)
  26. {
  27. return $this
  28. ->andWhere('.type = :type')
  29. ->setParameter('type', $type);
  30. }
  31. }