diff --git a/components/validator.rst b/components/validator.rst index 59afb7f963d..7da44454893 100644 --- a/components/validator.rst +++ b/components/validator.rst @@ -60,7 +60,7 @@ If you have lots of validation errors, you can filter them by error code:: use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; $violations = $validator->validate(...); - if (count($violations->findByCodes(UniqueEntity::NOT_UNIQUE_ERROR))) { + if (0 !== count($violations->findByCodes(UniqueEntity::NOT_UNIQUE_ERROR))) { // handle this specific error (display some message, send an email, etc.) }