Pārlūkot izejas kodu

TicketUtils : createTicketMessage

feature/export_comptable
Guillaume pirms 4 gadiem
vecāks
revīzija
1e2a26bd70
1 mainītis faili ar 23 papildinājumiem un 0 dzēšanām
  1. +23
    -0
      ShopBundle/Services/TicketUtils.php

+ 23
- 0
ShopBundle/Services/TicketUtils.php Parādīt failu

@@ -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 ;
}
}


Notiek ielāde…
Atcelt
Saglabāt