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
|
||||
*/
|
||||
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,
|
||||
|
@ -24,7 +24,7 @@ class ReportType extends AbstractType
|
||||
->add('person')
|
||||
->add('date')
|
||||
->add('scope')
|
||||
->add('cFData')
|
||||
->add('cFData', 'custom_field', array('group' => $options['cFGroup']))
|
||||
->add(
|
||||
$builder->create('cFGroup', 'text')
|
||||
->addModelTransformer($transformer)
|
||||
@ -43,10 +43,12 @@ class ReportType extends AbstractType
|
||||
|
||||
$resolver->setRequired(array(
|
||||
'em',
|
||||
'cFGroup',
|
||||
));
|
||||
|
||||
$resolver->setAllowedTypes(array(
|
||||
'em' => 'Doctrine\Common\Persistence\ObjectManager',
|
||||
'cFGroup' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup'
|
||||
));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user