Skip to content

Commit

Permalink
Merge pull request #717 from hackedd/patch-1
Browse files Browse the repository at this point in the history
Allow query parameters starting with an underscore
  • Loading branch information
guilhermeblanco committed Jul 29, 2013
2 parents 8d13601 + b5394fc commit a53fe14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Query/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function getCatchablePatterns()
'[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_]*'
);
}

Expand Down
9 changes: 9 additions & 0 deletions tests/Doctrine/Tests/ORM/Query/LexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ public function testScannerRecognizesNamedInputParameter()
$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'";
Expand Down

0 comments on commit a53fe14

Please sign in to comment.