1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Merge pull request #392 from widop/patch-1

Invalid paginator query cloning
This commit is contained in:
Benjamin Eberlei 2012-07-08 09:34:09 -07:00
commit fe292cc503
2 changed files with 14 additions and 1 deletions

View File

@ -208,7 +208,9 @@ class Paginator implements \Countable, \IteratorAggregate
{
/* @var $cloneQuery Query */
$cloneQuery = clone $query;
$cloneQuery->setParameters($query->getParameters());
$cloneQuery->setParameters(clone $query->getParameters());
foreach ($query->getHints() as $name => $value) {
$cloneQuery->setHint($name, $value);
}

View File

@ -128,6 +128,17 @@ class PaginationTest extends \Doctrine\Tests\OrmFunctionalTestCase
count($paginator);
}
public function testCloneQuery()
{
$dql = "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u";
$query = $this->_em->createQuery($dql);
$paginator = new Paginator($query);
$paginator->getIterator();
$this->assertTrue($query->getParameters()->isEmpty());
}
public function populate()
{
for ($i = 0; $i < 3; $i++) {