diff --git a/.gitignore b/.gitignore index 52d2b6ff7..b11589291 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ src/Chill/CustomFieldsBundle/vendor/* bootstrap.php.cache #the file created by composer to store creds auth.json +Tests/Fixtures/App/app/config/parameters.yml + diff --git a/Controller/CustomFieldController.php b/Controller/CustomFieldController.php index 8342ea765..46b013f82 100644 --- a/Controller/CustomFieldController.php +++ b/Controller/CustomFieldController.php @@ -76,14 +76,17 @@ class CustomFieldController extends Controller //add the custom field group if defined in URL $cfGroupId = $request->query->get('customFieldsGroup', null); - $cfGroup = $this->getDoctrine()->getManager() - ->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup') - ->find($cfGroupId); - if (!$cfGroup) { - throw $this->createNotFoundException('CustomFieldsGroup with id ' - . $cfGroupId.' is not found !'); + + if ($cfGroupId !== null) { + $cfGroup = $this->getDoctrine()->getManager() + ->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup') + ->find($cfGroupId); + if (!$cfGroup) { + throw $this->createNotFoundException('CustomFieldsGroup with id ' + . $cfGroupId.' is not found !'); + } + $entity->setCustomFieldsGroup($cfGroup); } - $entity->setCustomFieldsGroup($cfGroup); $form = $this->createCreateForm($entity, $request->query->get('type')); diff --git a/Resources/views/CustomField/new.html.twig b/Resources/views/CustomField/new.html.twig index 556c464ec..783cbb1d6 100644 --- a/Resources/views/CustomField/new.html.twig +++ b/Resources/views/CustomField/new.html.twig @@ -41,9 +41,15 @@