DDC-233 - Fixed use of array_merge() because it re-assigns the numerical indexes from 0 on.
This commit is contained in:
parent
375c470e93
commit
6e4e45e18e
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user