Преглед на файлове

TicketUtils : createTicketMessage

feature/export_comptable
Guillaume преди 4 години
родител
ревизия
1e2a26bd70
променени са 1 файла, в които са добавени 23 реда и са изтрити 0 реда
  1. +23
    -0
      ShopBundle/Services/TicketUtils.php

+ 23
- 0
ShopBundle/Services/TicketUtils.php Целия файл

@@ -2,6 +2,7 @@

namespace Lc\ShopBundle\Services ;

use App\Entity\TicketMessage;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
@@ -56,5 +57,27 @@ class TicketUtils

return $ticket ;
}

public function createTicketMessage($params)
{
$classTicketMessage = $this->em->getClassMetadata(TicketMessageInterface::class)->getName() ;
$ticketMessage = new $classTicketMessage ;

$ticket = $params['ticket'] ;

$ticketMessage->setStatus(1) ;
$ticketMessage->setTicket($ticket) ;
$ticketMessage->setMessage($params['message']) ;
$this->em->persist($ticketMessage);

if(isset($params['closeTicket']) && $params['closeTicket']) {
$ticket->setTicketStatus(Ticket::TICKET_STATUS_CLOSED) ;
$this->em->persist($ticket);
}

$this->em->flush() ;

return $ticketMessage ;
}
}


Loading…
Отказ
Запис