1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

Fix DDC-1697

This commit is contained in:
Fabio B. Silva 2012-03-24 22:50:54 -03:00
parent ab15528fde
commit df8626b949
2 changed files with 24 additions and 3 deletions

View file

@ -229,9 +229,9 @@ abstract class AbstractQuery
{
switch (true) {
case is_array($value):
for ($i = 0, $l = count($value); $i < $l; $i++) {
$paramValue = $this->processParameterValue($value[$i]);
$value[$i] = is_array($paramValue) ? $paramValue[key($paramValue)] : $paramValue;
foreach ($value as $key => $paramValue) {
$paramValue = $this->processParameterValue($paramValue);
$value[$key] = is_array($paramValue) ? $paramValue[key($paramValue)] : $paramValue;
}
return $value;

View file

@ -125,4 +125,25 @@ class QueryTest extends \Doctrine\Tests\OrmTestCase
$q = $this->_em->createQuery("SELECT DISTINCT u from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a");
$q->iterate();
}
/**
* @group DDC-1697
*/
public function testKeyValueParameters()
{
$cities = array(
0 => "Paris",
3 => "Canne",
9 => "St Julien"
);
$query = $this->_em
->createQuery("SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.city IN (:cities)")
->setParameter('cities', $cities);
$parameters = $query->getParameters();
$this->assertArrayHasKey('cities', $parameters);
$this->assertEquals($cities, $parameters['cities']);
}
}