|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
-
- namespace Lc\SovBundle\Repository\User;
-
- use App\Entity\Newsletter\Newsletter;
- use Lc\SovBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class UserStore extends AbstractStore implements UserStoreInterface
- {
- protected UserRepositoryQueryInterface $query;
-
- public function __construct(UserRepositoryQueryInterface $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- // findAllByNewsletter
- public function getByNewsletter(Newsletter $newsletter, $query = null): array
- {
- $query = $this->createQuery($query);
- $query->filterByNewsletter($newsletter);
- return $query->find();
- }
-
- // findByRole
- public function getByRole(string $role, $query = null): array
- {
- $query = $this->createQuery($query);
- $query->filterByRole($role);
- return $query->find();
- }
-
- // findByTicketTypesNotification
- public function getByTicketTypesNotification(string $ticketType, $query = null): array
- {
- $query = $this->createQuery($query);
- $query->filterByTicketTypeNotification($ticketType);
- return $query->find();
- }
-
- public function getOneByEmail(string $email, $query = null)
- {
- $query = $this->createQuery($query);
- $query->filterByEmail($email);
- return $query->findOne();
- }
-
- }
|