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