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.

66 satır
1.7KB

  1. <?php
  2. namespace Lc\SovBundle\Repository\User;
  3. use App\Entity\Newsletter\Newsletter;
  4. use Lc\SovBundle\Repository\AbstractStore;
  5. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  6. class UserStore extends AbstractStore implements UserStoreInterface
  7. {
  8. protected UserRepositoryQueryInterface $query;
  9. public function __construct(UserRepositoryQueryInterface $query)
  10. {
  11. $this->query = $query;
  12. }
  13. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  14. {
  15. $query->orderBy('id');
  16. return $query;
  17. }
  18. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  19. {
  20. return $query;
  21. }
  22. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  23. {
  24. return $query;
  25. }
  26. // findAllByNewsletter
  27. public function getByNewsletter(Newsletter $newsletter, $query = null): array
  28. {
  29. $query = $this->createQuery($query);
  30. $query->filterByNewsletter($newsletter);
  31. return $query->find();
  32. }
  33. // findByRole
  34. public function getByRole(string $role, $query = null): array
  35. {
  36. $query = $this->createQuery($query);
  37. $query->filterByRole($role);
  38. return $query->find();
  39. }
  40. // findByTicketTypesNotification
  41. public function getByTicketTypesNotification(string $ticketType, $query = null): array
  42. {
  43. $query = $this->createQuery($query);
  44. $query->filterByTicketTypeNotification($ticketType);
  45. return $query->find();
  46. }
  47. public function getOneByEmail(string $email, $query = null)
  48. {
  49. $query = $this->createQuery($query);
  50. $query->filterByEmail($email);
  51. return $query->findOne();
  52. }
  53. }