From ef83f5b39939bf1b333891a74e9ed0b79a36a1f8 Mon Sep 17 00:00:00 2001 From: foaly-nr1 Date: Mon, 30 Oct 2017 21:19:52 +0000 Subject: [PATCH] Use the correct type for the exception message Since the UoW checks each item of a *-to-many association to ensure it has the correct type, we should never say that we expect an instance of `Doctrine\Common\Collections\Collection` or an `array`. --- lib/Doctrine/ORM/ORMInvalidArgumentException.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/Doctrine/ORM/ORMInvalidArgumentException.php b/lib/Doctrine/ORM/ORMInvalidArgumentException.php index 796d2c5a515..68bb6f91dff 100644 --- a/lib/Doctrine/ORM/ORMInvalidArgumentException.php +++ b/lib/Doctrine/ORM/ORMInvalidArgumentException.php @@ -216,11 +216,7 @@ public static function invalidIdentifierBindingEntity() */ public static function invalidAssociation(ClassMetadata $targetClass, $assoc, $actualValue) { - $expectedType = 'Doctrine\Common\Collections\Collection|array'; - - if (($assoc['type'] & ClassMetadata::TO_ONE) > 0) { - $expectedType = $targetClass->getName(); - } + $expectedType = $targetClass->getName(); return new self(sprintf( 'Expected value of type "%s" for association field "%s#$%s", got "%s" instead.',