mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix display of checkbox field in user form
This commit is contained in:
parent
3ebeda9840
commit
0fc3c2eb1f
@ -225,10 +225,7 @@ class User implements AdvancedUserInterface
|
|||||||
|
|
||||||
public function getRoles(): array
|
public function getRoles(): array
|
||||||
{
|
{
|
||||||
$roles = $this->roles;
|
return array_unique($this->roles);
|
||||||
$roles[] = 'ROLE_USER';
|
|
||||||
|
|
||||||
return $roles;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSalt(): ?string
|
public function getSalt(): ?string
|
||||||
|
@ -105,17 +105,17 @@ class UserType extends AbstractType
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->get('roles')
|
// $builder->get('roles')
|
||||||
->addModelTransformer(new CallbackTransformer(
|
// ->addModelTransformer(new CallbackTransformer(
|
||||||
function ($rolesArray) {
|
// function ($rolesArray) {
|
||||||
// transform the array to a string
|
// // transform the array to a string
|
||||||
return count($rolesArray)? $rolesArray[0]: null;
|
// return count($rolesArray)? $rolesArray[0]: null;
|
||||||
},
|
// },
|
||||||
function ($rolesString) {
|
// function ($rolesString) {
|
||||||
// transform the string back to an array
|
// // transform the string back to an array
|
||||||
return [$rolesString];
|
// return [$rolesString];
|
||||||
}
|
// }
|
||||||
));
|
// ));
|
||||||
|
|
||||||
if ($options['is_creation']) {
|
if ($options['is_creation']) {
|
||||||
$builder->add('plainPassword', RepeatedType::class, [
|
$builder->add('plainPassword', RepeatedType::class, [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user