diff --git a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php index 6fc5b0611..804a208ef 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php +++ b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php @@ -438,8 +438,8 @@ class ResultSetMappingBuilder extends ResultSetMapping $sql .= $class->fieldMappings[$this->fieldMappings[$columnName]]['columnName']; } else if (isset($this->metaMappings[$columnName])) { $sql .= $this->metaMappings[$columnName]; - } else if (isset($this->discriminatorColumns[$columnName])) { - $sql .= $this->discriminatorColumns[$columnName]; + } else if (isset($this->discriminatorColumns[$dqlAlias])) { + $sql .= $this->discriminatorColumns[$dqlAlias]; } $sql .= " AS " . $columnName;