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.

39 line
1.0KB

  1. <?php
  2. namespace common\logic\Ticket\TicketUser\Repository;
  3. use common\logic\AbstractRepository;
  4. use common\logic\Ticket\Ticket\Model\Ticket;
  5. use common\logic\Ticket\TicketUser\Model\TicketUser;
  6. use common\logic\User\User\Model\User;
  7. class TicketUserRepository extends AbstractRepository
  8. {
  9. protected TicketUserRepositoryQuery $query;
  10. public function loadDependencies(): void
  11. {
  12. $this->loadQuery(TicketUserRepositoryQuery::class);
  13. }
  14. /**
  15. * Retourne les options de base nécessaires à la fonction de recherche.
  16. */
  17. public function getDefaultOptionsSearch(): array
  18. {
  19. return [
  20. self::WITH => ['ticket', 'user'],
  21. self::JOIN_WITH => [],
  22. self::ORDER_BY => '',
  23. self::ATTRIBUTE_ID_PRODUCER => ''
  24. ];
  25. }
  26. public function findOneTicketUser(Ticket $ticket, User $user): ?TicketUser
  27. {
  28. return $this->createDefaultQuery()
  29. ->filterByTicket($ticket)
  30. ->filterByUser($user)
  31. ->findOne();
  32. }
  33. }