1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Removed unnecessary spaces in generated SQL

This commit is contained in:
Alexander 2011-10-31 22:08:40 +01:00
parent 0f938b8c1d
commit 22b3b46b61
2 changed files with 10 additions and 10 deletions

View File

@ -1005,7 +1005,7 @@ class BasicEntityPersister
$first = true; $first = true;
if ($assoc['isOwningSide']) { if ($assoc['isOwningSide']) {
$this->_selectJoinSql .= $this->getJoinSQLForJoinColumns($assoc['joinColumns']); $this->_selectJoinSql .= ' ' . $this->getJoinSQLForJoinColumns($assoc['joinColumns']);
$this->_selectJoinSql .= ' ' . $eagerEntity->getQuotedTableName($this->_platform) . ' ' . $this->_getSQLTableAlias($eagerEntity->name, $assocAlias) .' ON '; $this->_selectJoinSql .= ' ' . $eagerEntity->getQuotedTableName($this->_platform) . ' ' . $this->_getSQLTableAlias($eagerEntity->name, $assocAlias) .' ON ';
foreach ($assoc['sourceToTargetKeyColumns'] AS $sourceCol => $targetCol) { foreach ($assoc['sourceToTargetKeyColumns'] AS $sourceCol => $targetCol) {
@ -1014,14 +1014,14 @@ class BasicEntityPersister
} }
$this->_selectJoinSql .= $this->_getSQLTableAlias($assoc['sourceEntity']) . '.' . $sourceCol . ' = ' $this->_selectJoinSql .= $this->_getSQLTableAlias($assoc['sourceEntity']) . '.' . $sourceCol . ' = '
. $this->_getSQLTableAlias($assoc['targetEntity'], $assocAlias) . '.' . $targetCol . ' '; . $this->_getSQLTableAlias($assoc['targetEntity'], $assocAlias) . '.' . $targetCol;
$first = false; $first = false;
} }
} else { } else {
$eagerEntity = $this->_em->getClassMetadata($assoc['targetEntity']); $eagerEntity = $this->_em->getClassMetadata($assoc['targetEntity']);
$owningAssoc = $eagerEntity->getAssociationMapping($assoc['mappedBy']); $owningAssoc = $eagerEntity->getAssociationMapping($assoc['mappedBy']);
$this->_selectJoinSql .= $this->getJoinSQLForJoinColumns($owningAssoc['joinColumns']); $this->_selectJoinSql .= ' ' . $this->getJoinSQLForJoinColumns($owningAssoc['joinColumns']);
$this->_selectJoinSql .= ' ' . $eagerEntity->getQuotedTableName($this->_platform) . ' ' $this->_selectJoinSql .= ' ' . $eagerEntity->getQuotedTableName($this->_platform) . ' '
. $this->_getSQLTableAlias($eagerEntity->name, $assocAlias) . ' ON '; . $this->_getSQLTableAlias($eagerEntity->name, $assocAlias) . ' ON ';
@ -1031,7 +1031,7 @@ class BasicEntityPersister
} }
$this->_selectJoinSql .= $this->_getSQLTableAlias($owningAssoc['sourceEntity'], $assocAlias) . '.' . $sourceCol . ' = ' $this->_selectJoinSql .= $this->_getSQLTableAlias($owningAssoc['sourceEntity'], $assocAlias) . '.' . $sourceCol . ' = '
. $this->_getSQLTableAlias($owningAssoc['targetEntity']) . '.' . $targetCol . ' '; . $this->_getSQLTableAlias($owningAssoc['targetEntity']) . '.' . $targetCol;
$first = false; $first = false;
} }
} }
@ -1513,10 +1513,10 @@ class BasicEntityPersister
// if one of the join columns is nullable, return left join // if one of the join columns is nullable, return left join
foreach($joinColumns as $joinColumn) { foreach($joinColumns as $joinColumn) {
if(isset($joinColumn['nullable']) && $joinColumn['nullable']){ if(isset($joinColumn['nullable']) && $joinColumn['nullable']){
return ' LEFT JOIN '; return 'LEFT JOIN';
} }
} }
return ' INNER JOIN '; return 'INNER JOIN';
} }
} }

View File

@ -125,8 +125,8 @@ class OneToOneEagerLoadingTest extends \Doctrine\Tests\OrmFunctionalTestCase
$train = $this->_em->find(get_class($train), $train->id); $train = $this->_em->find(get_class($train), $train->id);
$this->assertEquals( $this->assertEquals(
$this->_sqlLoggerStack->queries[$this->_sqlLoggerStack->currentQuery]['sql'], "SELECT t0.id AS id1, t0.driver_id AS driver_id2, t3.id AS id4, t3.name AS name5 FROM Train t0 LEFT JOIN TrainDriver t3 ON t0.driver_id = t3.id WHERE t0.id = ?",
"SELECT t0.id AS id1, t0.driver_id AS driver_id2, t3.id AS id4, t3.name AS name5 FROM Train t0 LEFT JOIN TrainDriver t3 ON t0.driver_id = t3.id WHERE t0.id = ?" $this->_sqlLoggerStack->queries[$this->_sqlLoggerStack->currentQuery]['sql']
); );
} }
@ -139,8 +139,8 @@ class OneToOneEagerLoadingTest extends \Doctrine\Tests\OrmFunctionalTestCase
$waggon = $this->_em->find(get_class($waggon), $waggon->id); $waggon = $this->_em->find(get_class($waggon), $waggon->id);
$this->assertEquals( $this->assertEquals(
$this->_sqlLoggerStack->queries[$this->_sqlLoggerStack->currentQuery]['sql'], "SELECT t0.id AS id1, t0.train_id AS train_id2, t3.id AS id4, t3.driver_id AS driver_id5 FROM Waggon t0 INNER JOIN Train t3 ON t0.train_id = t3.id WHERE t0.id = ?",
"SELECT t0.id AS id1, t0.train_id AS train_id2, t3.id AS id4, t3.driver_id AS driver_id5 FROM Waggon t0 INNER JOIN Train t3 ON t0.train_id = t3.id WHERE t0.id = ?" $this->_sqlLoggerStack->queries[$this->_sqlLoggerStack->currentQuery]['sql']
); );
} }
} }