Browse Source

TicketUtils : createTicketMessage

feature/export_comptable
Guillaume 4 years ago
parent
commit
1e2a26bd70
1 changed files with 23 additions and 0 deletions
  1. +23
    -0
      ShopBundle/Services/TicketUtils.php

+ 23
- 0
ShopBundle/Services/TicketUtils.php View File



namespace Lc\ShopBundle\Services ; namespace Lc\ShopBundle\Services ;


use App\Entity\TicketMessage;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface; use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderShopInterface; use Lc\ShopBundle\Context\OrderShopInterface;


return $ticket ; 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…
Cancel
Save