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.

30 satır
904B

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