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.

46 lines
1.3KB

  1. <?php
  2. namespace Lc\SovBundle\Repository\User;
  3. use App\Entity\Merchant\Merchant;
  4. use App\Entity\Newsletter\Newsletter;
  5. use Knp\Component\Pager\PaginatorInterface;
  6. use Lc\SovBundle\Repository\AbstractRepositoryQuery;
  7. class UserRepositoryQuery extends AbstractRepositoryQuery implements UserRepositoryQueryInterface
  8. {
  9. public function __construct(UserRepository $repository, PaginatorInterface $paginator)
  10. {
  11. parent::__construct($repository, 'r', $paginator);
  12. }
  13. public function filterByNewsletter(Newsletter $newsletter): self
  14. {
  15. return $this
  16. ->andWhere(':newsletter MEMBER OF .newsletters')
  17. ->setParameter('newsletter', $newsletter->getId());
  18. }
  19. public function filterByRole(string $role): self
  20. {
  21. return $this
  22. ->andWhere('.roles LIKE :roles')
  23. ->setParameter('roles', '%"' . $role . '"%');
  24. }
  25. public function filterByTicketTypeNotification(string $ticketType): self
  26. {
  27. return $this
  28. ->andWhere('.ticketTypesNotification LIKE :ticketType')
  29. ->setParameter('ticketType', '%"' . $ticketType . '"%');
  30. }
  31. public function filterByEmail(string $email): self
  32. {
  33. return $this
  34. ->andWhere('.email LIKE :email')
  35. ->setParameter('email', $email);
  36. }
  37. }