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.

36 lines
946B

  1. <?php
  2. namespace Lc\SovBundle\Repository\Ticket;
  3. use Knp\Component\Pager\PaginatorInterface;
  4. use Lc\SovBundle\Model\User\UserInterface;
  5. use Lc\SovBundle\Repository\AbstractRepositoryQuery;
  6. class TicketRepositoryQuery extends AbstractRepositoryQuery implements TicketRepositoryQueryInterface
  7. {
  8. public function __construct(TicketRepository $repository, PaginatorInterface $paginator)
  9. {
  10. parent::__construct($repository, 'r', $paginator);
  11. }
  12. public function filterByUser(UserInterface $user): self
  13. {
  14. return $this
  15. ->andWhere('.user = :user')
  16. ->setParameter('user', $user);
  17. }
  18. public function filterByStatus($statusArray): self
  19. {
  20. return $this
  21. ->andWhere('.status IN (:status)')
  22. ->setParameter('status', $statusArray);
  23. }
  24. public function selectCount(): self
  25. {
  26. return $this
  27. ->select('count(r.id) as count');
  28. }
  29. }