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

make QueryBuilder::getAllAliases public

This commit is contained in:
Kristopher Wilson 2015-02-14 15:35:02 -05:00
parent a13143b1ac
commit a6448f5c77
2 changed files with 23 additions and 1 deletions

View File

@ -473,7 +473,7 @@ class QueryBuilder
* </code>
* @return array
*/
private function getAllAliases() {
public function getAllAliases() {
return array_merge($this->getRootAliases(),array_keys($this->joinRootAliases));
}

View File

@ -1120,4 +1120,26 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals($dql, $dql2);
}
public function testGetAllAliasesWithNoJoins()
{
$qb = $this->_em->createQueryBuilder();
$qb->select('u')->from('Doctrine\Tests\Models\CMS\CmsUser', 'u');
$aliases = $qb->getAllAliases();
$this->assertEquals(['u'], $aliases);
}
public function testGetAllAliasesWithJoins()
{
$qb = $this->_em->createQueryBuilder()
->select('u')
->from('Doctrine\Tests\Models\CMS\CmsUser', 'u')
->join('u.groups', 'g');
$aliases = $qb->getAllAliases();
$this->assertEquals(['u', 'g'], $aliases);
}
}