Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

29 lines
803B

  1. <?php
  2. namespace domain\Ticket\TicketMessage;
  3. use domain\Ticket\Ticket\Ticket;
  4. use domain\User\User\User;
  5. use domain\_\AbstractBuilder;
  6. class TicketMessageBuilder extends AbstractBuilder
  7. {
  8. public function instanciateTicketMessage(Ticket $ticket, User $user, string $message = ''): TicketMessage
  9. {
  10. $ticketMessage = new TicketMessage();
  11. $ticketMessage->populateTicket($ticket);
  12. $ticketMessage->populateUser($user);
  13. $ticketMessage->message = $message;
  14. return $ticketMessage;
  15. }
  16. public function createTicketMessage(Ticket $ticket, User $user, string $message): TicketMessage
  17. {
  18. $ticketMessage = $this->instanciateTicketMessage($ticket, $user, $message);
  19. $this->saveCreate($ticketMessage);
  20. return $ticketMessage;
  21. }
  22. }