Set rootAlias outside loop
This commit is contained in:
parent
b6f8d53ff1
commit
202039e853
@ -1096,9 +1096,10 @@ class QueryBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rootAlias = $this->getRootAlias();
|
||||||
if ($criteria->getOrderings()) {
|
if ($criteria->getOrderings()) {
|
||||||
foreach ($criteria->getOrderings() as $sort => $order) {
|
foreach ($criteria->getOrderings() as $sort => $order) {
|
||||||
$this->addOrderBy($this->getRootAlias() . '.' . $sort, $order);
|
$this->addOrderBy($rootAlias . '.' . $sort, $order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,6 +402,9 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testAddCriteriaWhere()
|
public function testAddCriteriaWhere()
|
||||||
{
|
{
|
||||||
$qb = $this->_em->createQueryBuilder();
|
$qb = $this->_em->createQueryBuilder();
|
||||||
|
$qb->select('u')
|
||||||
|
->from('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||||
|
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
$criteria->where($criteria->expr()->eq('field', 'value'));
|
$criteria->where($criteria->expr()->eq('field', 'value'));
|
||||||
|
|
||||||
@ -429,6 +432,9 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testAddCriteriaLimit()
|
public function testAddCriteriaLimit()
|
||||||
{
|
{
|
||||||
$qb = $this->_em->createQueryBuilder();
|
$qb = $this->_em->createQueryBuilder();
|
||||||
|
$qb->select('u')
|
||||||
|
->from('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||||
|
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
$criteria->setFirstResult(2);
|
$criteria->setFirstResult(2);
|
||||||
$criteria->setMaxResults(10);
|
$criteria->setMaxResults(10);
|
||||||
@ -442,7 +448,11 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testAddCriteriaUndefinedLimit()
|
public function testAddCriteriaUndefinedLimit()
|
||||||
{
|
{
|
||||||
$qb = $this->_em->createQueryBuilder();
|
$qb = $this->_em->createQueryBuilder();
|
||||||
$qb->setFirstResult(2)->setMaxResults(10);
|
$qb->select('u')
|
||||||
|
->from('Doctrine\Tests\Models\CMS\CmsUser', 'u')
|
||||||
|
->setFirstResult(2)
|
||||||
|
->setMaxResults(10);
|
||||||
|
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
|
|
||||||
$qb->addCriteria($criteria);
|
$qb->addCriteria($criteria);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user