From ed516edf90b99f89d1d7f050f1ef7bdbb21b5c54 Mon Sep 17 00:00:00 2001
From: Benjamin Eberlei <kontakt@beberlei.de>
Date: Sun, 26 Jun 2011 17:49:34 +0200
Subject: [PATCH] Fix discriminator casing problem in Oracle

---
 lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php | 2 +-
 lib/Doctrine/ORM/Persisters/SingleTablePersister.php    | 2 +-
 lib/Doctrine/ORM/Query/SqlWalker.php                    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php b/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
index 1cb73a9d6..715495b01 100644
--- a/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
+++ b/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
@@ -284,7 +284,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
             }
 
             $resultColumnName = $this->_platform->getSQLResultCasing($discrColumn);
-            $this->_rsm->setDiscriminatorColumn('r', $discrColumn);
+            $this->_rsm->setDiscriminatorColumn('r', $resultColumnName);
             $this->_rsm->addMetaResult('r', $resultColumnName, $discrColumn);
         }
 
diff --git a/lib/Doctrine/ORM/Persisters/SingleTablePersister.php b/lib/Doctrine/ORM/Persisters/SingleTablePersister.php
index bf9104580..f910a8e06 100644
--- a/lib/Doctrine/ORM/Persisters/SingleTablePersister.php
+++ b/lib/Doctrine/ORM/Persisters/SingleTablePersister.php
@@ -49,7 +49,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
         $rootClass = $this->_em->getClassMetadata($this->_class->rootEntityName);
         $tableAlias = $this->_getSQLTableAlias($rootClass->name);
         $resultColumnName = $this->_platform->getSQLResultCasing($discrColumn);
-        $this->_rsm->setDiscriminatorColumn('r', $discrColumn);
+        $this->_rsm->setDiscriminatorColumn('r', $resultColumnName);
         $this->_rsm->addMetaResult('r', $resultColumnName, $discrColumn);
 
         // Append subclass columns
diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php
index f36e0ae8f..2a9f58faf 100644
--- a/lib/Doctrine/ORM/Query/SqlWalker.php
+++ b/lib/Doctrine/ORM/Query/SqlWalker.php
@@ -558,7 +558,7 @@ class SqlWalker implements TreeWalker
 
                 $columnAlias = $this->_platform->getSQLResultCasing($columnAlias);
                 $this->_rsm->setDiscriminatorColumn($dqlAlias, $columnAlias);
-                $this->_rsm->addMetaResult($dqlAlias, $this->_platform->getSQLResultCasing($columnAlias), $discrColumn['fieldName']);
+                $this->_rsm->addMetaResult($dqlAlias, $columnAlias, $discrColumn['fieldName']);
 
                 // Add foreign key columns to SQL, if necessary
                 if ($addMetaColumns) {