DDC-1298 - Fix bug in SQLWalker with derived entities that have no fields of their own.
This commit is contained in:
parent
a0b7c3e76d
commit
196632978c
@ -511,7 +511,7 @@ class SqlWalker implements TreeWalker
|
||||
public function walkSelectClause($selectClause)
|
||||
{
|
||||
$sql = 'SELECT ' . (($selectClause->isDistinct) ? 'DISTINCT ' : '') . implode(
|
||||
', ', array_map(array($this, 'walkSelectExpression'), $selectClause->selectExpressions)
|
||||
', ', array_filter(array_map(array($this, 'walkSelectExpression'), $selectClause->selectExpressions))
|
||||
);
|
||||
|
||||
$addMetaColumns = ! $this->_query->getHint(Query::HINT_FORCE_PARTIAL_LOAD) &&
|
||||
|
@ -27,6 +27,11 @@ class DDC117Article
|
||||
*/
|
||||
private $translations;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="DDC117Link", mappedBy="source")
|
||||
*/
|
||||
private $links;
|
||||
|
||||
public function __construct($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
@ -965,6 +965,17 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
||||
"SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3, (SELECT c1_.name FROM cms_users c1_ WHERE c1_.id = c0_.id AND c1_.name IN (SELECT c2_.name FROM cms_users c2_)) AS sclr4 FROM cms_users c0_"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1298
|
||||
*/
|
||||
public function testSelectForeignKeyPKWithoutFields()
|
||||
{
|
||||
$this->assertSqlGeneration(
|
||||
"SELECT t, s, l FROM Doctrine\Tests\Models\DDC117\DDC117Link l INNER JOIN l.target t INNER JOIN l.source s",
|
||||
"SELECT d0_.article_id AS article_id0, d0_.title AS title1, d1_.article_id AS article_id2, d1_.title AS title3 FROM DDC117Link d2_ INNER JOIN DDC117Article d0_ ON d2_.target_id = d0_.article_id INNER JOIN DDC117Article d1_ ON d2_.source_id = d1_.article_id"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,6 +98,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
|
||||
'Doctrine\Tests\Models\DDC117\DDC117ArticleDetails',
|
||||
'Doctrine\Tests\Models\DDC117\DDC117ApproveChanges',
|
||||
'Doctrine\Tests\Models\DDC117\DDC117Editor',
|
||||
'Doctrine\Tests\Models\DDC117\DDC117Link',
|
||||
),
|
||||
'stockexchange' => array(
|
||||
'Doctrine\Tests\Models\StockExchange\Bond',
|
||||
@ -191,6 +192,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
|
||||
$conn->executeUpdate('DELETE FROM ddc117editor_ddc117translation');
|
||||
$conn->executeUpdate('DELETE FROM DDC117Editor');
|
||||
$conn->executeUpdate('DELETE FROM DDC117ApproveChanges');
|
||||
$conn->executeUpdate('DELETE FROM DDC117Link');
|
||||
$conn->executeUpdate('DELETE FROM DDC117Reference');
|
||||
$conn->executeUpdate('DELETE FROM DDC117ArticleDetails');
|
||||
$conn->executeUpdate('DELETE FROM DDC117Translation');
|
||||
|
Loading…
x
Reference in New Issue
Block a user