commit
8a52e3033b
@ -229,9 +229,9 @@ abstract class AbstractQuery
|
|||||||
{
|
{
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case is_array($value):
|
case is_array($value):
|
||||||
for ($i = 0, $l = count($value); $i < $l; $i++) {
|
foreach ($value as $key => $paramValue) {
|
||||||
$paramValue = $this->processParameterValue($value[$i]);
|
$paramValue = $this->processParameterValue($paramValue);
|
||||||
$value[$i] = is_array($paramValue) ? $paramValue[key($paramValue)] : $paramValue;
|
$value[$key] = is_array($paramValue) ? $paramValue[key($paramValue)] : $paramValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -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 = $this->_em->createQuery("SELECT DISTINCT u from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a");
|
||||||
$q->iterate();
|
$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']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user