|
@@ -59,7 +59,11 @@ class HelperController
|
|
|
public function __construct(\Twig_Environment $twig, Pool $pool, AdminHelper $helper, $validator)
|
|
|
{
|
|
|
if (!($validator instanceof ValidatorInterface) && !($validator instanceof LegacyValidatorInterface)) {
|
|
|
- throw new \InvalidArgumentException('Argument 4 is an instance of '.get_class($validator).', expecting an instance of \Symfony\Component\Validator\Validator\ValidatorInterface or \Symfony\Component\Validator\ValidatorInterface');
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Argument 4 is an instance of '.get_class($validator).', expecting an instance of'
|
|
|
+ .' \Symfony\Component\Validator\Validator\ValidatorInterface or'
|
|
|
+ .' \Symfony\Component\Validator\ValidatorInterface'
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
$this->twig = $twig;
|
|
@@ -136,7 +140,9 @@ class HelperController
|
|
|
if ($objectId) {
|
|
|
$subject = $admin->getModelManager()->find($admin->getClass(), $objectId);
|
|
|
if (!$subject) {
|
|
|
- throw new NotFoundHttpException(sprintf('Unable to find the object id: %s, class: %s', $objectId, $admin->getClass()));
|
|
|
+ throw new NotFoundHttpException(
|
|
|
+ sprintf('Unable to find the object id: %s, class: %s', $objectId, $admin->getClass())
|
|
|
+ );
|
|
|
}
|
|
|
} else {
|
|
|
$subject = $admin->getNewInstance();
|
|
@@ -257,7 +263,10 @@ class HelperController
|
|
|
}
|
|
|
|
|
|
if (!$fieldDescription->getOption('editable')) {
|
|
|
- return new JsonResponse(array('status' => 'KO', 'message' => 'The field cannot be edit, editable option must be set to true'));
|
|
|
+ return new JsonResponse(array(
|
|
|
+ 'status' => 'KO',
|
|
|
+ 'message' => 'The field cannot be edit, editable option must be set to true',
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
$propertyPath = new PropertyPath($field);
|
|
@@ -348,7 +357,9 @@ class HelperController
|
|
|
$formAutocomplete = $admin->getForm()->get($fieldDescription->getName());
|
|
|
|
|
|
if ($formAutocomplete->getConfig()->getAttribute('disabled')) {
|
|
|
- throw new AccessDeniedException('Autocomplete list can`t be retrieved because the form element is disabled or read_only.');
|
|
|
+ throw new AccessDeniedException(
|
|
|
+ 'Autocomplete list can`t be retrieved because the form element is disabled or read_only.'
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
$property = $formAutocomplete->getConfig()->getAttribute('property');
|
|
@@ -386,7 +397,11 @@ class HelperController
|
|
|
// multiple properties
|
|
|
foreach ($property as $prop) {
|
|
|
if (!$datagrid->hasFilter($prop)) {
|
|
|
- throw new \RuntimeException(sprintf('To retrieve autocomplete items, you should add filter "%s" to "%s" in configureDatagridFilters() method.', $prop, get_class($targetAdmin)));
|
|
|
+ throw new \RuntimeException(sprintf(
|
|
|
+ 'To retrieve autocomplete items,'
|
|
|
+ .' you should add filter "%s" to "%s" in configureDatagridFilters() method.',
|
|
|
+ $prop, get_class($targetAdmin)
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
$filter = $datagrid->getFilter($prop);
|
|
@@ -396,7 +411,12 @@ class HelperController
|
|
|
}
|
|
|
} else {
|
|
|
if (!$datagrid->hasFilter($property)) {
|
|
|
- throw new \RuntimeException(sprintf('To retrieve autocomplete items, you should add filter "%s" to "%s" in configureDatagridFilters() method.', $property, get_class($targetAdmin)));
|
|
|
+ throw new \RuntimeException(sprintf(
|
|
|
+ 'To retrieve autocomplete items,'
|
|
|
+ .' you should add filter "%s" to "%s" in configureDatagridFilters() method.',
|
|
|
+ $property,
|
|
|
+ get_class($targetAdmin)
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
$datagrid->setValue($property, null, $searchText);
|