do not validate empty values

This commit is contained in:
Christian Flothmann 2017-06-30 20:18:03 +02:00
parent 7acc34537b
commit fd7ad234bc
3 changed files with 9 additions and 1 deletions

View File

@ -62,6 +62,10 @@ class UniqueEntityValidator extends ConstraintValidator
throw new ConstraintDefinitionException('At least one field has to be specified.');
}
if (null === $entity) {
return;
}
if ($constraint->em) {
$em = $this->registry->getManager($constraint->em);

View File

@ -39,6 +39,10 @@ class UserPasswordValidator extends ConstraintValidator
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword');
}
if (null === $password || '' === $password) {
return;
}
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {

View File

@ -48,7 +48,7 @@ class UrlValidator extends ConstraintValidator
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url');
}
if (null === $value) {
if (null === $value || '' === $value) {
return;
}