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.
|
- <?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
- {
- 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;
- }
-
- }
|