Vous ne pouvez pas sélectionner plus de 25 sujets
Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
|
- <?php
-
- namespace Lc\SovBundle\Factory\Ticket;
-
- use App\Entity\Ticket\Ticket;
- use Doctrine\ORM\EntityManagerInterface;
- use Lc\SovBundle\Factory\AbstractFactory;
- use Lc\SovBundle\Model\Ticket\TicketInterface;
-
- class TicketFactory extends AbstractFactory implements TicketFactoryInterface
- {
- protected $ticketMessageFactory;
-
- public function __construct(EntityManagerInterface $em, TicketMessageFactory $ticketMessageFactory)
- {
- $this->ticketMessageFactory = $ticketMessageFactory;
-
- parent::__construct($em);
- }
-
- public function getEntityClass()
- {
- return TicketInterface::class;
- }
-
- public function create($params = array())
- {
- if (!isset($params['status'])) {
- $params['status'] = Ticket::TICKET_STATUS_OPEN;
- }
-
- $ticket = parent::create($params);
-
- if (!isset($params['ticketMessages'])) {
- $ticket->addTicketMessage($this->ticketMessageFactory->create());
- }
-
- return $ticket;
- }
-
- }
|