Adding CustomFieldsData for Report

This commit is contained in:
Marc Ducobu
2014-11-08 18:34:19 +01:00
parent c0c36bc1ec
commit 0fe3962968
2 changed files with 11 additions and 7 deletions

View File

@@ -95,12 +95,13 @@ class ReportController extends Controller
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Report $entity)
private function createCreateForm(Report $entity, $cFGroup)
{
$form = $this->createForm(new ReportType(), $entity, array(
'action' => $this->generateUrl('report_create'),
'method' => 'POST',
'em' => $this->getDoctrine()->getManager(),
'cFGroup' => $cFGroup,
));
$form->add('submit', 'submit', array('label' => 'Create'));
@@ -120,13 +121,14 @@ class ReportController extends Controller
$cFGroupId = $request->query->get('cFGroup');
if($cFGroupId) {
$entity->setCFGroup(
$em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($cFGroupId)
);
if(! $cFGroupId) {
throw new Exception("Error Processing Request", 1);
}
$form = $this->createCreateForm($entity);
$cFGroup = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($cFGroupId);
$entity->setCFGroup($cFGroup);
$form = $this->createCreateForm($entity, $cFGroup);
return $this->render('ChillReportBundle:Report:new.html.twig', array(
'entity' => $entity,