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:
parent
b211dd4db7
commit
c0a505366f
@ -216,11 +216,7 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
|
|||||||
*/
|
*/
|
||||||
public static function invalidAssociation(ClassMetadata $targetClass, $assoc, $actualValue)
|
public static function invalidAssociation(ClassMetadata $targetClass, $assoc, $actualValue)
|
||||||
{
|
{
|
||||||
$expectedType = 'Doctrine\Common\Collections\Collection|array';
|
$expectedType = $targetClass->getName();
|
||||||
|
|
||||||
if (($assoc['type'] & ClassMetadata::TO_ONE) > 0) {
|
|
||||||
$expectedType = $targetClass->getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new self(sprintf(
|
return new self(sprintf(
|
||||||
'Expected value of type "%s" for association field "%s#$%s", got "%s" instead.',
|
'Expected value of type "%s" for association field "%s#$%s", got "%s" instead.',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user