Commit 6e4e45e1 authored by beberlei's avatar beberlei

DDC-233 - Fixed use of array_merge() because it re-assigns the numerical indexes from 0 on.

parent 375c470e
......@@ -154,7 +154,7 @@ abstract class AbstractQuery
public function getParameters($params = array())
{
if ($params) {
return array_merge($this->_params, $params);
return ($this->_params + $params);
}
return $this->_params;
}
......
......@@ -29,6 +29,19 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase
$query->execute(array(42)); // same as array(0 => 42), 0 is invalid parameter position
}
public function testGetParameters()
{
$query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1");
$this->assertEquals(array(1 => 42), $query->getParameters(array(1 => 42)));
}
public function testGetParameters_HasSomeAlready()
{
$query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1");
$query->setParameter(2, 84);
$this->assertEquals(array(2 => 84, 1 => 42), $query->getParameters(array(1 => 42)));
}
public function testSimpleQueries()
{
$user = new CmsUser;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment