From 0cecb67645c611a5c1b9eaf92a8db8390ae0cd9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 24 Feb 2015 21:24:42 +0100 Subject: [PATCH] fix form for new custom group If the CustomFieldGroup->getEntity is not set, the form for creation throw an error --- Form/CustomFieldsGroupType.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Form/CustomFieldsGroupType.php b/Form/CustomFieldsGroupType.php index 204c4e3f8..4ab4379ff 100644 --- a/Form/CustomFieldsGroupType.php +++ b/Form/CustomFieldsGroupType.php @@ -49,11 +49,16 @@ class CustomFieldsGroupType extends AbstractType )) ; - $builder->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) - use ($customizableEntities, $builder){ + $builder->addEventListener(FormEvents::POST_SET_DATA, + function(FormEvent $event) use ($customizableEntities, $builder){ $form = $event->getForm(); $group = $event->getData(); + //stop the function if entity is not set + if ($group->getEntity() === NULL) { + return; + } + if (count($customizableEntities[$group->getEntity()]['options']) > 0) { $optionBuilder = $builder ->getFormFactory()