choice with other + some development tips

This commit is contained in:
2014-11-10 11:25:25 +01:00
parent f9be8e3412
commit 952d70f049
18 changed files with 466 additions and 9 deletions

View File

@@ -244,4 +244,5 @@ class CustomFieldController extends Controller
->getForm()
;
}
}

View File

@@ -146,7 +146,6 @@ class CustomFieldsGroupController extends Controller
'action' => $this->generateUrl('customfieldsgroup_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' => 'Update'));
return $form;
@@ -221,4 +220,44 @@ class CustomFieldsGroupController extends Controller
->getForm()
;
}
/**
* 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
*/
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', 'submit', array('label' => 'POST'));
$form->handleRequest($request);
if ($form->isSubmitted()) {
var_dump($form->getData());
var_dump(json_encode($form->getData()));
}
$this->get('twig.loader')
->addPath(__DIR__.'/../Tests/Fixtures/App/app/Resources/views/',
$namespace = 'test');
return $this
->render('@test/CustomField/simple_form_render.html.twig', array(
'form' => $form->createView()
));
}
}