EcommerceBundle/Controller/FeatureController.php
public function newAction()
    {
        $entity = new Feature();

        if ($this->getRequest()->query->has('category')) {
            $em = $this->getDoctrine()->getManager();

            $category = $em->getRepository('EcommerceBundle:Category')->
                find($this->getRequest()->query->get('category'));

            $entity->setCategory($category);
        }

        $form   = $this->createForm(new FeatureType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
public function newAction()
    {
        $entity = new Feature();

        if ($this->getRequest()->query->has('category')) {
            $em = $this->getDoctrine()->getManager();

            $category = $em->getRepository('EcommerceBundle:Category')->
                find($this->getRequest()->query->get('category'));

            $entity->setCategory($category);
        }

        $form   = $this->createForm(new FeatureType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
public function newAction ( ) { $ entity = new Feature ( ) ; if ( $ this -> getRequest ( ) -> query -> has ( 'category' ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ category = $ em -> getRepository ( 'EcommerceBundle:Category' ) -> find ( $ this -> getRequest ( ) -> query -> get ( 'category' ) ) ; $ entity -> setCategory ( $ category ) ; } $ form = $ this -> createForm ( new FeatureType ( ) , $ entity ) ; return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; }
Displays a form to create a new Feature entity.

@return array

@Route("/new")
@Method("GET")
@Template()
Displays a form to create a new Feature entity .