make QueryBuilder::getAllAliases public
This commit is contained in:
parent
a13143b1ac
commit
a6448f5c77
@ -473,7 +473,7 @@ class QueryBuilder
|
||||
* </code>
|
||||
* @return array
|
||||
*/
|
||||
private function getAllAliases() {
|
||||
public function getAllAliases() {
|
||||
return array_merge($this->getRootAliases(),array_keys($this->joinRootAliases));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user