EcommerceBundle/Controller/FeatureController.php
public function createAction(Request $request)
    {
        $entity = new Feature();
        $form = $this->createForm(new FeatureType(), $entity);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            $this->get('session')->getFlashBag()->add('success', 'feature.created');

            return $this->redirect($this->generateUrl('ecommerce_feature_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
public function createAction(Request $request)
    {
        $entity = new Feature();
        $form = $this->createForm(new FeatureType(), $entity);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            $this->get('session')->getFlashBag()->add('success', 'feature.created');

            return $this->redirect($this->generateUrl('ecommerce_feature_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
public function createAction ( Request $ request ) { $ entity = new Feature ( ) ; $ form = $ this -> createForm ( new FeatureType ( ) , $ entity ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'feature.created' ) ; return $ this -> redirect ( $ this -> generateUrl ( 'ecommerce_feature_show' , array ( 'id' => $ entity -> getId ( ) ) ) ) ; } return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; }
Creates a new Feature entity.

@param Request $request The request

@return array|RedirectResponse

@Route("/")
@Method("POST")
@Template("EcommerceBundle:Feature:new.html.twig")
Creates a new Feature entity .