Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

40 rindas
989B

  1. <?php
  2. namespace domain\Ticket\TicketMessage;
  3. use domain\_\AbstractRepository;
  4. class TicketMessageRepository extends AbstractRepository
  5. {
  6. protected TicketMessageRepositoryQuery $query;
  7. public function loadDependencies(): void
  8. {
  9. $this->loadQuery(TicketMessageRepositoryQuery::class);
  10. }
  11. /**
  12. * Retourne les options de base nécessaires à la fonction de recherche.
  13. */
  14. public function getDefaultOptionsSearch(): array
  15. {
  16. return [
  17. self::WITH => ['user'],
  18. self::JOIN_WITH => [],
  19. self::ORDER_BY => '',
  20. self::ATTRIBUTE_ID_PRODUCER => ''
  21. ];
  22. }
  23. public function findTicketMessagesByTicketId(int $ticketId)
  24. {
  25. return $this->createDefaultQuery()
  26. ->filterByTicketId($ticketId)
  27. ->find();
  28. }
  29. public function countTicketMessagesByTicketId(int $ticketId): int
  30. {
  31. return count($this->findTicketMessagesByTicketId($ticketId));
  32. }
  33. }