fix form to jump to create a custom field

This commit is contained in:
2015-11-07 09:38:12 +01:00
parent 59ce457131
commit e1435d0883
2 changed files with 30 additions and 5 deletions

View File

@@ -33,6 +33,14 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
if (null === $customFieldsGroup) {
return "";
}
if (!$customFieldsGroup instanceof CustomFieldsGroup) {
throw new TransformationFailedException(sprintf('Transformation failed: '
. 'the expected type of the transforme function is an '
. 'object of type Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, '
. '%s given (value : %s)', gettype($customFieldsGroup),
$customFieldsGroup));
}
return $customFieldsGroup->getId();
}
@@ -49,6 +57,14 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
if (!$id) {
return null;
}
if ($id instanceof CustomFieldsGroup) {
throw new TransformationFailedException(sprintf(
'The transformation failed: the expected argument on '
. 'reverseTransform is an object of type int,'
. 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, '
. 'given', gettype($id)));
}
$customFieldsGroup = $this->om
->getRepository('ChillCustomFieldsBundle:customFieldsGroup')->find($id)