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

Merge pull request #308 from FabioBatSilva/DDC-1697

Fix DDC-1697
This commit is contained in:
Guilherme Blanco 2012-03-24 20:29:52 -07:00
commit 8a52e3033b
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']);
}
}