1
0
mirror of synced 2025-01-18 14:31:40 +03:00

[2.0][DDC-55] Fixed.

This commit is contained in:
romanb 2009-10-28 11:29:29 +00:00
parent 7694e9b7b9
commit aa72619c5d
3 changed files with 18 additions and 0 deletions

View File

@ -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()) {

View File

@ -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);
}
}

View 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()
{