Fix syntax

This commit is contained in:
Jean-Francois Monfort 2021-01-19 11:48:42 +01:00
parent 764d2cc87a
commit ce34fea7e4

View File

@ -87,8 +87,7 @@ class ScopePickerType extends AbstractType
$items = $query->getQuery()->execute();
if (1 !== count($items)) {
$builder->add(
'scope', EntityType::class, [
$builder->add('scope', EntityType::class, [
'class' => Scope::class,
'placeholder' => 'Choose the circle',
'choice_label' => function (Scope $c) {
@ -97,15 +96,12 @@ class ScopePickerType extends AbstractType
'query_builder' => function () use ($options) {
return $this->buildAccessibleScopeQuery($options['center'], $options['role']);
},
]
);
]);
$builder->setDataMapper(new ScopePickerDataMapper());
} else {
$builder->add(
'scope', HiddenType::class, [
$builder->add('scope', HiddenType::class, [
'data' => $items[0]->getId(),
]
);
]);
$builder->setDataMapper(new ScopePickerDataMapper($items[0]));
}
}
@ -114,7 +110,7 @@ class ScopePickerType extends AbstractType
{
$view->vars = array_replace(
$view->vars, [
'hideLabel' => true,
'hideLabel' => true,
]
);
}