diff --git a/framework/validators/ExistValidator.php b/framework/validators/ExistValidator.php index 6479395410..a3aa4aa652 100644 --- a/framework/validators/ExistValidator.php +++ b/framework/validators/ExistValidator.php @@ -111,7 +111,7 @@ class ExistValidator extends Validator $query = $this->createQuery($targetClass, $params); if (is_array($object->$attribute)) { - if ($query->count("DISTINCT [[$targetAttribute]]") === count($object->$attribute)) { + if ($query->count("DISTINCT [[$targetAttribute]]") == count($object->$attribute)) { return; } } elseif ($query->exists()) {