Fix basic entity persister type resolver
Which was using the wrong way to fetch the field type and using the association type instead of the column type.
This commit is contained in:
parent
b952dac339
commit
d47c1f3e9b
@ -37,6 +37,8 @@ use Doctrine\ORM\Query;
|
|||||||
use Doctrine\ORM\UnitOfWork;
|
use Doctrine\ORM\UnitOfWork;
|
||||||
use Doctrine\ORM\Utility\IdentifierFlattener;
|
use Doctrine\ORM\Utility\IdentifierFlattener;
|
||||||
use Doctrine\ORM\Utility\PersisterHelper;
|
use Doctrine\ORM\Utility\PersisterHelper;
|
||||||
|
use function array_merge;
|
||||||
|
use function reset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A BasicEntityPersister maps an entity to a single table in a relational database.
|
* A BasicEntityPersister maps an entity to a single table in a relational database.
|
||||||
@ -459,20 +461,13 @@ class BasicEntityPersister implements EntityPersister
|
|||||||
);
|
);
|
||||||
|
|
||||||
$targetMapping = $this->em->getClassMetadata($this->class->associationMappings[$idField]['targetEntity']);
|
$targetMapping = $this->em->getClassMetadata($this->class->associationMappings[$idField]['targetEntity']);
|
||||||
|
$targetType = PersisterHelper::getTypeOfField($targetMapping->identifier[0], $targetMapping, $this->em);
|
||||||
|
|
||||||
switch (true) {
|
if ($targetType === []) {
|
||||||
case (isset($targetMapping->fieldMappings[$targetMapping->identifier[0]])):
|
|
||||||
$types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (isset($targetMapping->associationMappings[$targetMapping->identifier[0]])):
|
|
||||||
$types[] = $targetMapping->associationMappings[$targetMapping->identifier[0]]['type'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw ORMException::unrecognizedField($targetMapping->identifier[0]);
|
throw ORMException::unrecognizedField($targetMapping->identifier[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$types[] = reset($targetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($versioned) {
|
if ($versioned) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user