1
0
mirror of synced 2025-01-17 22:11:41 +03:00

Merge pull request #717 from hackedd/patch-1

Allow query parameters starting with an underscore
This commit is contained in:
Guilherme Blanco 2013-07-29 13:37:51 -07:00
commit a53fe14fa2
2 changed files with 10 additions and 1 deletions

View File

@ -129,7 +129,7 @@ class Lexer extends \Doctrine\Common\Lexer
'[a-z_\\\][a-z0-9_\:\\\]*[a-z0-9_]{1}',
'(?:[0-9]+(?:[\.][0-9]+)*)(?:e[+-]?[0-9]+)?',
"'(?:[^']|'')*'",
'\?[0-9]*|:[a-z]{1}[a-z0-9_]{0,}'
'\?[0-9]*|:[a-z_][a-z0-9_]*'
);
}

View File

@ -158,6 +158,15 @@ class LexerTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals(':name', $token['value']);
}
public function testScannerRecognizesNamedInputParameterStartingWithUnderscore()
{
$lexer = new Lexer(':_name');
$lexer->moveNext();
$token = $lexer->lookahead;
$this->assertEquals(Lexer::T_INPUT_PARAMETER, $token['type']);
$this->assertEquals(':_name', $token['value']);
}
public function testScannerTokenizesASimpleQueryCorrectly()
{
$dql = "SELECT u FROM My\Namespace\User u WHERE u.name = 'Jack O''Neil'";