Merge pull request #1303 from mrkrstphr/querybuilder-get-all-aliases
make QueryBuilder::getAllAliases public
This commit is contained in:
commit
4daf383e4f
@ -473,7 +473,7 @@ class QueryBuilder
|
||||
* </code>
|
||||
* @return array
|
||||
*/
|
||||
private function getAllAliases() {
|
||||
public function getAllAliases() {
|
||||
return array_merge($this->getRootAliases(),array_keys($this->joinRootAliases));
|
||||
}
|
||||
|
||||
|
@ -1150,4 +1150,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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user