1
0
mirror of synced 2024-12-13 06:46:03 +03:00

[2.0] DDC-370 - Fixed bug with CTI and scalar fields DDC-377 - Fixed failing Oracle test

This commit is contained in:
beberlei 2010-02-26 20:29:01 +00:00
parent 839603dafe
commit 5bf169202f
2 changed files with 14 additions and 7 deletions

View File

@ -816,7 +816,13 @@ class SqlWalker implements TreeWalker
$resultAlias = $selectExpression->fieldIdentificationVariable; $resultAlias = $selectExpression->fieldIdentificationVariable;
} }
$sqlTableAlias = $this->getSqlTableAlias($class->getTableName(), $dqlAlias); if ($class->isInheritanceTypeJoined()) {
$tableName = $this->_em->getUnitOfWork()->getEntityPersister($class->name)->getOwningTable($fieldName);
} else {
$tableName = $class->getTableName();
}
$sqlTableAlias = $this->getSqlTableAlias($tableName, $dqlAlias);
$columnName = $class->getQuotedColumnName($fieldName, $this->_platform); $columnName = $class->getQuotedColumnName($fieldName, $this->_platform);
$columnAlias = $this->getSqlColumnAlias($columnName); $columnAlias = $this->getSqlColumnAlias($columnName);

View File

@ -28,7 +28,7 @@ class AdvancedDqlQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase
{ {
$dql = 'SELECT p.department, AVG(p.salary) AS avgSalary '. $dql = 'SELECT p.department, AVG(p.salary) AS avgSalary '.
'FROM Doctrine\Tests\Models\Company\CompanyEmployee p '. 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p '.
'GROUP BY p.department HAVING SUM(p.salary) > 200000'; 'GROUP BY p.department HAVING SUM(p.salary) > 200000 ORDER BY p.department';
$result = $this->_em->createQuery($dql)->getScalarResult(); $result = $this->_em->createQuery($dql)->getScalarResult();
@ -97,22 +97,23 @@ class AdvancedDqlQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->assertEquals('Roman B.', $result[0]['name']); $this->assertEquals('Roman B.', $result[0]['name']);
} }
/*public function testGroupByMultipleFields() public function testGroupByMultipleFields()
{ {
$dql = 'SELECT p.department, p.name, count(p.id) FROM Doctrine\Tests\Models\Company\CompanyEmployee p '. $dql = 'SELECT p.department, p.name, count(p.id) FROM Doctrine\Tests\Models\Company\CompanyEmployee p '.
'GROUP BY p.department, p.name'; 'GROUP BY p.department, p.name';
$result = $this->_em->createQuery($dql)->getResult(); $result = $this->_em->createQuery($dql)->getResult();
}*/
/** $this->assertEquals(4, count($result));
}
public function testUpdateAs() public function testUpdateAs()
{ {
$dql = 'UPDATE Doctrine\Tests\Models\Company\CompanyEmployee AS p SET p.salary = 1'; $dql = 'UPDATE Doctrine\Tests\Models\Company\CompanyEmployee AS p SET p.salary = 1';
$this->_em->createQuery($dql)->getResult(); $this->_em->createQuery($dql)->getResult();
$this->assertTrue(count($this->_em->createQuery( $this->assertTrue(count($this->_em->createQuery(
'SELECT count(p) FROM Doctrine\Tests\Models\Company\CompanyEmployee p WHERE p.salary = 1')->getResult()) > 0); 'SELECT count(p.id) FROM Doctrine\Tests\Models\Company\CompanyEmployee p WHERE p.salary = 1')->getResult()) > 0);
}*/ }
/*public function testDeleteAs() /*public function testDeleteAs()
{ {