mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix errors to user picker: add placeholder and allow empty
This commit is contained in:
parent
d684851f36
commit
6f73c9ee09
@ -83,7 +83,7 @@ class UserPickerType extends AbstractType
|
||||
|
||||
$resolver
|
||||
->setDefault('class', User::class)
|
||||
->setDefault('empty_data', $this->tokenStorage->getToken()->getUser())
|
||||
->setDefault('placeholder', 'Choose an user')
|
||||
->setDefault('choice_label', function(User $u) {
|
||||
return $u->getUsername();
|
||||
})
|
||||
|
@ -50,6 +50,10 @@ class UserCircleConsistencyValidator extends ConstraintValidator
|
||||
/* @var $user \Chill\MainBundle\Entity\User */
|
||||
$user = \call_user_func([$value, $constraint->getUserFunction ]);
|
||||
|
||||
if ($user === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (FALSE === $this->autorizationHelper->userHasAccess($user, $value, $constraint->role)) {
|
||||
$this->context
|
||||
->buildViolation($constraint->message)
|
||||
|
Loading…
x
Reference in New Issue
Block a user