您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

62 行
1.7KB

  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, 'user', $paginator);
  12. }
  13. protected $isJoinGroupUsers = false;
  14. public function joinGroupUsers($addSelect = true): self
  15. {
  16. if (!$this->isJoinGroupUsers) {
  17. $this->isJoinGroupUsers = true;
  18. $this->innerJoin('.groupUsers', 'groupUsers');
  19. if($addSelect){
  20. $this->addSelect('groupUsers');
  21. }
  22. }
  23. return $this;
  24. }
  25. public function filterByNewsletter(Newsletter $newsletter): self
  26. {
  27. return $this
  28. ->andWhere(':newsletter MEMBER OF .newsletters')
  29. ->setParameter('newsletter', $newsletter->getId());
  30. }
  31. public function filterByRole(string $role): self
  32. {
  33. return $this
  34. ->andWhere('.roles LIKE :roles')
  35. ->setParameter('roles', '%"' . $role . '"%');
  36. }
  37. public function filterByTicketTypeNotification(string $ticketType): self
  38. {
  39. return $this
  40. ->andWhere('.ticketTypesNotification LIKE :ticketType')
  41. ->setParameter('ticketType', '%"' . $ticketType . '"%');
  42. }
  43. public function filterByEmail(string $email): self
  44. {
  45. return $this
  46. ->andWhere('.email LIKE :email')
  47. ->setParameter('email', $email);
  48. }
  49. }