Controller/TicketController.php
public function createAction(Request $request)
    {
        $ticketManager = $this->get('hackzilla_ticket.ticket_manager');

        $ticket = $ticketManager->createTicket();
        $form   = $this->createForm(TicketType::class, $ticket);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $message = $ticket->getMessages()->current();
            $message->setStatus(TicketMessageInterface::STATUS_OPEN)
                ->setUser($this->getUserManager()->getCurrentUser());

            $ticketManager->updateTicket($ticket, $message);
            $this->dispatchTicketEvent(TicketEvents::TICKET_CREATE, $ticket);

            return $this->redirect($this->generateUrl('hackzilla_ticket_show', ['ticketId' => $ticket->getId()]));
        }

        return $this->render(
            $this->container->getParameter('hackzilla_ticket.templates')['new'],
            [
                'entity' => $ticket,
                'form'   => $form->createView(),
            ]
        );
    }
public function createAction(Request $request)
    {
        $ticketManager = $this->get('hackzilla_ticket.ticket_manager');

        $ticket = $ticketManager->createTicket();
        $form   = $this->createForm(TicketType::class, $ticket);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $message = $ticket->getMessages()->current();
            $message->setStatus(TicketMessageInterface::STATUS_OPEN)
                ->setUser($this->getUserManager()->getCurrentUser());

            $ticketManager->updateTicket($ticket, $message);
            $this->dispatchTicketEvent(TicketEvents::TICKET_CREATE, $ticket);

            return $this->redirect($this->generateUrl('hackzilla_ticket_show', ['ticketId' => $ticket->getId()]));
        }

        return $this->render(
            $this->container->getParameter('hackzilla_ticket.templates')['new'],
            [
                'entity' => $ticket,
                'form'   => $form->createView(),
            ]
        );
    }
public function createAction ( Request $ request ) { $ ticketManager = $ this -> get ( 'hackzilla_ticket.ticket_manager' ) ; $ ticket = $ ticketManager -> createTicket ( ) ; $ form = $ this -> createForm ( TicketType :: class , $ ticket ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ message = $ ticket -> getMessages ( ) -> current ( ) ; $ message -> setStatus ( TicketMessageInterface :: STATUS_OPEN ) -> setUser ( $ this -> getUserManager ( ) -> getCurrentUser ( ) ) ; $ ticketManager -> updateTicket ( $ ticket , $ message ) ; $ this -> dispatchTicketEvent ( TicketEvents :: TICKET_CREATE , $ ticket ) ; return $ this -> redirect ( $ this -> generateUrl ( 'hackzilla_ticket_show' , [ 'ticketId' => $ ticket -> getId ( ) ] ) ) ; } return $ this -> render ( $ this -> container -> getParameter ( 'hackzilla_ticket.templates' ) [ 'new' ] , [ 'entity' => $ ticket , 'form' => $ form -> createView ( ) , ] ) ; }
Creates a new Ticket entity.

@param Request $request

@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
Creates a new Ticket entity .