diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index cd92d04ab..984d2da0c 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -225,10 +225,7 @@ class User implements AdvancedUserInterface public function getRoles(): array { - $roles = $this->roles; - $roles[] = 'ROLE_USER'; - - return $roles; + return array_unique($this->roles); } public function getSalt(): ?string diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php index 7873e7082..5c65dd7c7 100644 --- a/src/Bundle/ChillMainBundle/Form/UserType.php +++ b/src/Bundle/ChillMainBundle/Form/UserType.php @@ -105,17 +105,17 @@ class UserType extends AbstractType }, ]); - $builder->get('roles') - ->addModelTransformer(new CallbackTransformer( - function ($rolesArray) { - // transform the array to a string - return count($rolesArray)? $rolesArray[0]: null; - }, - function ($rolesString) { - // transform the string back to an array - return [$rolesString]; - } - )); + // $builder->get('roles') + // ->addModelTransformer(new CallbackTransformer( + // function ($rolesArray) { + // // transform the array to a string + // return count($rolesArray)? $rolesArray[0]: null; + // }, + // function ($rolesString) { + // // transform the string back to an array + // return [$rolesString]; + // } + // )); if ($options['is_creation']) { $builder->add('plainPassword', RepeatedType::class, [