Fixed mapping of discriminator column
Added fix for [DDC-3170] (http://www.doctrine-project.org/jira/browse/DDC-3170). When querying a simple entity which uses single table- or class table inheritance using simple object hydration (``AbstractQuery::HYDRATE_SIMPLEOBJECT``), the mapped discriminator column was not retrieved correctly. If the column got an alias during result set mapping other than it's actual name (e.g. ``type34`` insteaad of ``type``) than this alias wasn't reverted when retrieving the discriminator column from the SQL result set.
This commit is contained in:
parent
7aa1c0a907
commit
a7aa634247
1 changed files with 5 additions and 0 deletions
|
@ -75,6 +75,11 @@ class SimpleObjectHydrator extends AbstractHydrator
|
|||
if ($this->class->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {
|
||||
$discrColumnName = $this->_platform->getSQLResultCasing($this->class->discriminatorColumn['name']);
|
||||
|
||||
// Find mapped discriminator column from the result set.
|
||||
if ($metaMappingDiscrColumnName = array_search($discrColumnName, $this->_rsm->metaMappings)) {
|
||||
$discrColumnName = $metaMappingDiscrColumnName;
|
||||
}
|
||||
|
||||
if ( ! isset($sqlResult[$discrColumnName])) {
|
||||
throw HydrationException::missingDiscriminatorColumn($entityName, $discrColumnName, key($this->_rsm->aliasMap));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue