[2.0][DDC-55] Fixed.
This commit is contained in:
parent
7694e9b7b9
commit
aa72619c5d
@ -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);
|
||||
}
|
||||
}
|
@ -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()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user