DDC-1384 - Fix a bunch of Oracle test failures
This commit is contained in:
parent
fb55e8094b
commit
50e028212d
@ -86,20 +86,22 @@ class ResultSetMappingBuilder extends ResultSetMapping
|
|||||||
if (isset($renamedColumns[$columnName])) {
|
if (isset($renamedColumns[$columnName])) {
|
||||||
$columnName = $renamedColumns[$columnName];
|
$columnName = $renamedColumns[$columnName];
|
||||||
}
|
}
|
||||||
|
$columnName = $platform->getSQLResultCasing($columnName);
|
||||||
if (isset($this->fieldMappings[$columnName])) {
|
if (isset($this->fieldMappings[$columnName])) {
|
||||||
throw new \InvalidArgumentException("The column '$columnName' conflicts with another column in the mapper.");
|
throw new \InvalidArgumentException("The column '$columnName' conflicts with another column in the mapper.");
|
||||||
}
|
}
|
||||||
$this->addFieldResult($alias, $platform->getSQLResultCasing($columnName), $propertyName);
|
$this->addFieldResult($alias, $columnName, $propertyName);
|
||||||
}
|
}
|
||||||
foreach ($classMetadata->associationMappings AS $associationMapping) {
|
foreach ($classMetadata->associationMappings AS $associationMapping) {
|
||||||
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
|
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
|
||||||
foreach ($associationMapping['joinColumns'] AS $joinColumn) {
|
foreach ($associationMapping['joinColumns'] AS $joinColumn) {
|
||||||
$columnName = $joinColumn['name'];
|
$columnName = $joinColumn['name'];
|
||||||
$renamedColumnName = isset($renamedColumns[$columnName]) ? $renamedColumns[$columnName] : $columnName;
|
$renamedColumnName = isset($renamedColumns[$columnName]) ? $renamedColumns[$columnName] : $columnName;
|
||||||
|
$renamedColumnName = $platform->getSQLResultCasing($renamedColumnName);
|
||||||
if (isset($this->metaMappings[$renamedColumnName])) {
|
if (isset($this->metaMappings[$renamedColumnName])) {
|
||||||
throw new \InvalidArgumentException("The column '$renamedColumnName' conflicts with another column in the mapper.");
|
throw new \InvalidArgumentException("The column '$renamedColumnName' conflicts with another column in the mapper.");
|
||||||
}
|
}
|
||||||
$this->addMetaResult($alias, $platform->getSQLResultCasing($renamedColumnName), $platform->getSQLResultCasing($columnName));
|
$this->addMetaResult($alias, $renamedColumnName, $columnName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -33,11 +31,13 @@ require_once __DIR__ . '/../../TestInit.php';
|
|||||||
* @link http://www.doctrine-project.org
|
* @link http://www.doctrine-project.org
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
class CustomTreeWalkersTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
class CustomTreeWalkersTest extends \Doctrine\Tests\OrmTestCase
|
||||||
{
|
{
|
||||||
protected function setUp() {
|
private $_em;
|
||||||
$this->useModelSet('cms');
|
|
||||||
parent::setUp();
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->_em = $this->_getTestEntityManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed)
|
public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed)
|
||||||
|
@ -34,8 +34,8 @@ class DDC1225Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
->setParameter(1, 0);
|
->setParameter(1, 0);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'SELECT t0_.test_entity2_id AS test_entity2_id0 FROM te1 t0_ WHERE t0_.test_entity2_id = ?',
|
strtolower('SELECT t0_.test_entity2_id AS test_entity2_id0 FROM te1 t0_ WHERE t0_.test_entity2_id = ?'),
|
||||||
$qb->getQuery()->getSQL()
|
strtolower($qb->getQuery()->getSQL())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,15 @@ class DDC331Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-331
|
||||||
|
*/
|
||||||
public function testSelectFieldOnRootEntity()
|
public function testSelectFieldOnRootEntity()
|
||||||
{
|
{
|
||||||
$employee = new CompanyEmployee;
|
|
||||||
$employee->setName('Roman S. Borschel');
|
|
||||||
$employee->setSalary(100000);
|
|
||||||
$employee->setDepartment('IT');
|
|
||||||
|
|
||||||
$this->_em->persist($employee);
|
|
||||||
$this->_em->flush();
|
|
||||||
$this->_em->clear();
|
|
||||||
|
|
||||||
$q = $this->_em->createQuery('SELECT e.name FROM Doctrine\Tests\Models\Company\CompanyEmployee e');
|
$q = $this->_em->createQuery('SELECT e.name FROM Doctrine\Tests\Models\Company\CompanyEmployee e');
|
||||||
$this->assertEquals('SELECT c0_.name AS name0 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id LEFT JOIN company_managers c2_ ON c1_.id = c2_.id', $q->getSql());
|
$this->assertEquals(
|
||||||
|
strtolower('SELECT c0_.name AS name0 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id LEFT JOIN company_managers c2_ ON c1_.id = c2_.id'),
|
||||||
|
strtolower($q->getSql())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,7 +19,10 @@ class DDC719Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
{
|
{
|
||||||
$q = $this->_em->createQuery('SELECT g, c FROM Doctrine\Tests\ORM\Functional\Ticket\DDC719Group g LEFT JOIN g.children c WHERE g.parents IS EMPTY');
|
$q = $this->_em->createQuery('SELECT g, c FROM Doctrine\Tests\ORM\Functional\Ticket\DDC719Group g LEFT JOIN g.children c WHERE g.parents IS EMPTY');
|
||||||
|
|
||||||
$this->assertEquals('SELECT g0_.name AS name0, g0_.description AS description1, g0_.id AS id2, g1_.name AS name3, g1_.description AS description4, g1_.id AS id5 FROM groups g0_ LEFT JOIN groups_groups g2_ ON g0_.id = g2_.parent_id LEFT JOIN groups g1_ ON g1_.id = g2_.child_id WHERE (SELECT COUNT(*) FROM groups_groups g3_ WHERE g3_.child_id = g0_.id) = 0', $q->getSQL());
|
$this->assertEquals(
|
||||||
|
strtolower('SELECT g0_.name AS name0, g0_.description AS description1, g0_.id AS id2, g1_.name AS name3, g1_.description AS description4, g1_.id AS id5 FROM groups g0_ LEFT JOIN groups_groups g2_ ON g0_.id = g2_.parent_id LEFT JOIN groups g1_ ON g1_.id = g2_.child_id WHERE (SELECT COUNT(*) FROM groups_groups g3_ WHERE g3_.child_id = g0_.id) = 0'),
|
||||||
|
strtolower($q->getSQL())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1255,13 +1255,25 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
/**
|
/**
|
||||||
* @group DDC-1384
|
* @group DDC-1384
|
||||||
*/
|
*/
|
||||||
function testAliasDoesNotExceedPlatformDefinedLength()
|
public function testAliasDoesNotExceedPlatformDefinedLength()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT m FROM ' . __NAMESPACE__ . '\\DDC1384Model m',
|
'SELECT m FROM ' . __NAMESPACE__ . '\\DDC1384Model m',
|
||||||
"SELECT d0_.aVeryLongIdentifierThatShouldBeShortenedByTheSQLWalker_fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo AS fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo0 FROM DDC1384Model d0_"
|
"SELECT d0_.aVeryLongIdentifierThatShouldBeShortenedByTheSQLWalker_fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo AS fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo0 FROM DDC1384Model d0_"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-331
|
||||||
|
* @group DDC-1384
|
||||||
|
*/
|
||||||
|
public function testIssue331()
|
||||||
|
{
|
||||||
|
$this->assertSqlGeneration(
|
||||||
|
'SELECT e.name FROM Doctrine\Tests\Models\Company\CompanyEmployee e',
|
||||||
|
'SELECT c0_.name AS name0 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user