1
0
mirror of synced 2025-02-09 00:39:25 +03:00

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`.
This commit is contained in:
foaly-nr1 2017-10-30 21:19:52 +00:00 committed by Luís Cobucci
parent b211dd4db7
commit c0a505366f
No known key found for this signature in database
GPG Key ID: EC61C5F01750ED3C

View File

@ -216,11 +216,7 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
*/
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.',