src/GPublicationBundle/Controller/ReactionController.php
/**
     * Creates a new reaction entity.
     *
     * @Method({"GET", "POST"})
     */
Creates a new reaction entity.
Creates a new reaction entity .
public function newAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        $reaction = new Reaction();
        $formReaction = $this->createForm('GPublicationBundle\Form\ReactionType', $reaction);
        $formReaction->handleRequest($request);
        if ($formReaction->isSubmitted() && $formReaction->isValid()) {
            $reaction->setUser($this->getUser());
            $em->persist($reaction);
            $em->flush();
            return $this->redirectToRoute('g_publication_Ajout');
        }
        return $this->render('GPublicationBundle:Publication:AjoutPub.html.twig', array(
            'reaction' => $reaction,
            'formReaction' => $formReaction->createView()
        ));
    }
public function newAction ( Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ reaction = new Reaction ( ) ; $ formReaction = $ this -> createForm ( 'GPublicationBundle\Form\ReactionType' , $ reaction ) ; $ formReaction -> handleRequest ( $ request ) ; if ( $ formReaction -> isSubmitted ( ) && $ formReaction -> isValid ( ) ) { $ reaction -> setUser ( $ this -> getUser ( ) ) ; $ em -> persist ( $ reaction ) ; $ em -> flush ( ) ; return $ this -> redirectToRoute ( 'g_publication_Ajout' ) ; } return $ this -> render ( 'GPublicationBundle:Publication:AjoutPub.html.twig' , array ( 'reaction' => $ reaction , 'formReaction' => $ formReaction -> createView ( ) ) ) ; }
Creates a new reaction entity.
Creates a new reaction entity .