src/AppBundle/Controller/Astillero/ServicioController.php
/**
     * Creates a new servicio entity.
     *
     * @Route("/nuevo", name="astillero_servicio_new")
     * @Method({"GET", "POST"})
     */
Creates a new servicio entity.
Creates a new servicio entity .
public function newAction(Request $request)
    {
        $servicio = new Servicio();
        $form = $this->createForm('AppBundle\Form\Astillero\ServicioType', $servicio);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($servicio);
            $em->flush();
            return $this->redirectToRoute('astillero_servicio_show',['id'=>$servicio->getId()]);
        }
        return $this->render('astillero/servicio/new.html.twig', array(
            'servicio' => $servicio,
            'form' => $form->createView(),
            'title' => 'Astillero Nuevo Servicio'
        ));
    }
public function newAction ( Request $ request ) { $ servicio = new Servicio ( ) ; $ form = $ this -> createForm ( 'AppBundle\Form\Astillero\ServicioType' , $ servicio ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ servicio ) ; $ em -> flush ( ) ; return $ this -> redirectToRoute ( 'astillero_servicio_show' , [ 'id' => $ servicio -> getId ( ) ] ) ; } return $ this -> render ( 'astillero/servicio/new.html.twig' , array ( 'servicio' => $ servicio , 'form' => $ form -> createView ( ) , 'title' => 'Astillero Nuevo Servicio' ) ) ; }
Creates a new servicio entity.
Creates a new servicio entity .