[DoctrineBridge] Bypass the db when no valid identifier is provided in ORMQueryBuilderLoader
This commit is contained in:
parent
45579fd7cd
commit
086c58c716
@ -95,6 +95,9 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface
|
|||||||
} else {
|
} else {
|
||||||
$parameterType = Connection::PARAM_STR_ARRAY;
|
$parameterType = Connection::PARAM_STR_ARRAY;
|
||||||
}
|
}
|
||||||
|
if (!$values) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
return $qb->andWhere($where)
|
return $qb->andWhere($where)
|
||||||
->getQuery()
|
->getQuery()
|
||||||
|
@ -56,7 +56,7 @@ class ORMQueryBuilderLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$query->expects($this->once())
|
$query->expects($this->once())
|
||||||
->method('setParameter')
|
->method('setParameter')
|
||||||
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(), $expectedType)
|
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2), $expectedType)
|
||||||
->willReturn($query);
|
->willReturn($query);
|
||||||
|
|
||||||
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
|
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
|
||||||
@ -72,7 +72,7 @@ class ORMQueryBuilderLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->from($classname, 'e');
|
->from($classname, 'e');
|
||||||
|
|
||||||
$loader = new ORMQueryBuilderLoader($qb);
|
$loader = new ORMQueryBuilderLoader($qb);
|
||||||
$loader->getEntitiesByIds('id', array());
|
$loader->getEntitiesByIds('id', array(1, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFilterNonIntegerValues()
|
public function testFilterNonIntegerValues()
|
||||||
|
Reference in New Issue
Block a user