public function newAction(Request $request)
    {
        $entity = new CustomField();
        
        //add the custom field group if defined in URL
        $cfGroupId = $request->query->get('customFieldsGroup', null);
        
        if ($cfGroupId !== null) {
            $cfGroup = $this->getDoctrine()->getManager()
                  ->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
                  ->find($cfGroupId);
            if (!$cfGroup) {
                throw $this->createNotFoundException('CustomFieldsGroup with id '
                      . $cfGroupId.' is not found !');
            }
            $entity->setCustomFieldsGroup($cfGroup);
        }
        
        $form   = $this->createCreateForm($entity, $request->query->get('type'));

        return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }
public function newAction(Request $request)
    {
        $entity = new CustomField();
        
        //add the custom field group if defined in URL
        $cfGroupId = $request->query->get('customFieldsGroup', null);
        
        if ($cfGroupId !== null) {
            $cfGroup = $this->getDoctrine()->getManager()
                  ->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
                  ->find($cfGroupId);
            if (!$cfGroup) {
                throw $this->createNotFoundException('CustomFieldsGroup with id '
                      . $cfGroupId.' is not found !');
            }
            $entity->setCustomFieldsGroup($cfGroup);
        }
        
        $form   = $this->createCreateForm($entity, $request->query->get('type'));

        return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }
public function newAction ( Request $ request ) { $ entity = new CustomField ( ) ; //add the custom field group if defined in URL $ cfGroupId = $ request -> query -> get ( 'customFieldsGroup' , null ) ; if ( $ cfGroupId !== null ) { $ cfGroup = $ this -> getDoctrine ( ) -> getManager ( ) -> getRepository ( 'ChillCustomFieldsBundle:CustomFieldsGroup' ) -> find ( $ cfGroupId ) ; if ( ! $ cfGroup ) { throw $ this -> createNotFoundException ( 'CustomFieldsGroup with id ' . $ cfGroupId . ' is not found !' ) ; } $ entity -> setCustomFieldsGroup ( $ cfGroup ) ; } $ form = $ this -> createCreateForm ( $ entity , $ request -> query -> get ( 'type' ) ) ; return $ this -> render ( 'ChillCustomFieldsBundle:CustomField:new.html.twig' , array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ) ; }
Displays a form to create a new CustomField entity.
Displays a form to create a new CustomField entity .