From 9919dcc2e5cd9c29a463fbf065b8fb938abd9e2f Mon Sep 17 00:00:00 2001 From: Nicolas LEFEVRE Date: Sun, 9 Sep 2018 16:01:21 +0200 Subject: [PATCH] [Validator] fix condition in if statement --- components/validator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.) }