diff --git a/Form/Type/UserPickerType.php b/Form/Type/UserPickerType.php index a9a0bf62e..b253ce393 100644 --- a/Form/Type/UserPickerType.php +++ b/Form/Type/UserPickerType.php @@ -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(); }) diff --git a/Validator/Constraints/Entity/UserCircleConsistencyValidator.php b/Validator/Constraints/Entity/UserCircleConsistencyValidator.php index adba2d760..c8ec72b50 100644 --- a/Validator/Constraints/Entity/UserCircleConsistencyValidator.php +++ b/Validator/Constraints/Entity/UserCircleConsistencyValidator.php @@ -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)