mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Adding CustomFieldsData for Report
This commit is contained in:
parent
c0c36bc1ec
commit
0fe3962968
@ -95,12 +95,13 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Symfony\Component\Form\Form The form
|
* @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(
|
$form = $this->createForm(new ReportType(), $entity, array(
|
||||||
'action' => $this->generateUrl('report_create'),
|
'action' => $this->generateUrl('report_create'),
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'em' => $this->getDoctrine()->getManager(),
|
'em' => $this->getDoctrine()->getManager(),
|
||||||
|
'cFGroup' => $cFGroup,
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
$form->add('submit', 'submit', array('label' => 'Create'));
|
||||||
@ -120,13 +121,14 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
$cFGroupId = $request->query->get('cFGroup');
|
$cFGroupId = $request->query->get('cFGroup');
|
||||||
|
|
||||||
if($cFGroupId) {
|
if(! $cFGroupId) {
|
||||||
$entity->setCFGroup(
|
throw new Exception("Error Processing Request", 1);
|
||||||
$em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($cFGroupId)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$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(
|
return $this->render('ChillReportBundle:Report:new.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
|
@ -24,7 +24,7 @@ class ReportType extends AbstractType
|
|||||||
->add('person')
|
->add('person')
|
||||||
->add('date')
|
->add('date')
|
||||||
->add('scope')
|
->add('scope')
|
||||||
->add('cFData')
|
->add('cFData', 'custom_field', array('group' => $options['cFGroup']))
|
||||||
->add(
|
->add(
|
||||||
$builder->create('cFGroup', 'text')
|
$builder->create('cFGroup', 'text')
|
||||||
->addModelTransformer($transformer)
|
->addModelTransformer($transformer)
|
||||||
@ -43,10 +43,12 @@ class ReportType extends AbstractType
|
|||||||
|
|
||||||
$resolver->setRequired(array(
|
$resolver->setRequired(array(
|
||||||
'em',
|
'em',
|
||||||
|
'cFGroup',
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setAllowedTypes(array(
|
$resolver->setAllowedTypes(array(
|
||||||
'em' => 'Doctrine\Common\Persistence\ObjectManager',
|
'em' => 'Doctrine\Common\Persistence\ObjectManager',
|
||||||
|
'cFGroup' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user