Commit aa72619c authored by romanb's avatar romanb

[2.0][DDC-55] Fixed.

parent 7694e9b7
......@@ -459,6 +459,10 @@ abstract class AbstractQuery
}
$params = $this->getParameters($params);
if (isset($params[0])) {
throw QueryException::invalidParameterPosition(0);
}
// Check result cache
if ($this->_useResultCache && $cacheDriver = $this->getResultCacheDriver()) {
......
......@@ -44,4 +44,9 @@ class QueryException extends \Doctrine\Common\DoctrineException
{
return new self('[Semantical Error] ' . $message);
}
public static function invalidParameterPosition($pos)
{
return new self('Invalid parameter position: ' . $pos);
}
}
\ No newline at end of file
......@@ -19,6 +19,15 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->useModelSet('cms');
parent::setUp();
}
/**
* @expectedException Doctrine\ORM\Query\QueryException
*/
public function testParameterIndexZeroThrowsException()
{
$query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1");
$query->execute(array(42)); // same as array(0 => 42), 0 is invalid parameter position
}
public function testSimpleQueries()
{
......
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