src/CentraleLille/SearchBundle/Controller/DemoController.php
/**
     * Creates a new Demo entity.
     *
     * @Route("/new", name="demo_new")
     * @Method({"GET", "POST"})
     */
Creates a new Demo entity.
Creates a new Demo entity .
public function newAction(Request $request)
    {
        $demo = new Demo();
        $form = $this->createForm('CentraleLille\SearchBundle\Form\DemoType', $demo);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($demo);
            $em->flush();
            return $this->redirectToRoute('demo_show', array('id' => $demo->getId()));
        }
        return $this->render('demo/new.html.twig', array(
            'demo' => $demo,
            'form' => $form->createView(),
        ));
    }
public function newAction ( Request $ request ) { $ demo = new Demo ( ) ; $ form = $ this -> createForm ( 'CentraleLille\SearchBundle\Form\DemoType' , $ demo ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ demo ) ; $ em -> flush ( ) ; return $ this -> redirectToRoute ( 'demo_show' , array ( 'id' => $ demo -> getId ( ) ) ) ; } return $ this -> render ( 'demo/new.html.twig' , array ( 'demo' => $ demo , 'form' => $ form -> createView ( ) , ) ) ; }
Creates a new Demo entity.
Creates a new Demo entity .