public function renderFormAction($id, Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id);
    
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find CustomFieldsGroups entity.');
        }
    
        $form = $this->createForm('custom_field', null, array('group' => $entity));
        $form->add('submit_dump', 'submit', array('label' => 'POST AND DUMP'));
        $form->add('submit_render','submit', array('label' => 'POST AND RENDER'));
        $form->handleRequest($request);
        
        $this->get('twig.loader')
        ->addPath(__DIR__.'/../Tests/Fixtures/App/app/Resources/views/',
            $namespace = 'test');
        
        if ($form->isSubmitted()) {
            if ($form->get('submit_render')->isClicked()) {
                return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:render_for_test.html.twig', array(
                    'fields' => $form->getData(),
                    'customFieldsGroup' => $entity
                ));
            }
            
            var_dump($form->getData());
            var_dump(json_enccode($form->getData()));
        }
    
        
    
        return $this
            ->render('@test/CustomField/simple_form_render.html.twig', array(
                'form' => $form->createView()
        ));
    
    }
public function renderFormAction($id, Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id);
    
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find CustomFieldsGroups entity.');
        }
    
        $form = $this->createForm('custom_field', null, array('group' => $entity));
        $form->add('submit_dump', 'submit', array('label' => 'POST AND DUMP'));
        $form->add('submit_render','submit', array('label' => 'POST AND RENDER'));
        $form->handleRequest($request);
        
        $this->get('twig.loader')
        ->addPath(__DIR__.'/../Tests/Fixtures/App/app/Resources/views/',
            $namespace = 'test');
        
        if ($form->isSubmitted()) {
            if ($form->get('submit_render')->isClicked()) {
                return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:render_for_test.html.twig', array(
                    'fields' => $form->getData(),
                    'customFieldsGroup' => $entity
                ));
            }
            
            var_dump($form->getData());
            var_dump(json_enccode($form->getData()));
        }
    
        
    
        return $this
            ->render('@test/CustomField/simple_form_render.html.twig', array(
                'form' => $form->createView()
        ));
    
    }
public function renderFormAction ( $ id , Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'ChillCustomFieldsBundle:CustomFieldsGroup' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find CustomFieldsGroups entity.' ) ; } $ form = $ this -> createForm ( 'custom_field' , null , array ( 'group' => $ entity ) ) ; $ form -> add ( 'submit_dump' , 'submit' , array ( 'label' => 'POST AND DUMP' ) ) ; $ form -> add ( 'submit_render' , 'submit' , array ( 'label' => 'POST AND RENDER' ) ) ; $ form -> handleRequest ( $ request ) ; $ this -> get ( 'twig.loader' ) -> addPath ( __DIR__ . '/../Tests/Fixtures/App/app/Resources/views/' , $ namespace = 'test' ) ; if ( $ form -> isSubmitted ( ) ) { if ( $ form -> get ( 'submit_render' ) -> isClicked ( ) ) { return $ this -> render ( 'ChillCustomFieldsBundle:CustomFieldsGroup:render_for_test.html.twig' , array ( 'fields' => $ form -> getData ( ) , 'customFieldsGroup' => $ entity ) ) ; } var_dump ( $ form -> getData ( ) ) ; var_dump ( json_enccode ( $ form -> getData ( ) ) ) ; } return $ this -> render ( '@test/CustomField/simple_form_render.html.twig' , array ( 'form' => $ form -> createView ( ) ) ) ; }
This function render the customFieldsGroup as a form.

This function is for testing purpose !

The route which call this action is not in Resources/config/routing.yml,
but in Tests/Fixtures/App/app/config.yml

@param int $id
This function render the customFieldsGroup as a form .