From 6aef05bf57daf9eae1265624508d1c809036e965 Mon Sep 17 00:00:00 2001 From: Geoffrey Vincent Date: Mon, 16 Nov 2015 11:41:14 +0100 Subject: [PATCH] Use equals function to allow validation of a cloned object --- Validator/Constraints/UniqueObjectValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validator/Constraints/UniqueObjectValidator.php b/Validator/Constraints/UniqueObjectValidator.php index a8bedf3..fe28085 100644 --- a/Validator/Constraints/UniqueObjectValidator.php +++ b/Validator/Constraints/UniqueObjectValidator.php @@ -52,7 +52,7 @@ class UniqueObjectValidator extends ConstraintValidator $bddUsers = $bddUsersQuery->find(); $countUser = count($bddUsers); - if ($countUser > 1 || ($countUser === 1 && $object !== $bddUsers[0])) { + if ($countUser > 1 || ($countUser === 1 && !$object->equals($bddUsers[0]))) { $fieldParts = array(); foreach ($fields as $fieldName) {