1
0
mirror of synced 2024-12-13 22:56:04 +03:00

[DDC-1091] Fix bug with custom string functions in StringPrimary

This commit is contained in:
Benjamin Eberlei 2011-05-01 11:01:30 +02:00
parent d0b95bb31c
commit c53baa9935
2 changed files with 12 additions and 1 deletions

View File

@ -2308,7 +2308,8 @@ class Parser
if ($peek['value'] == '.') {
return $this->StateFieldPathExpression();
} else if ($peek['value'] == '(') {
return $this->FunctionsReturningStrings();
// do NOT directly go to FunctionsReturningString() because it doesnt check for custom functions.
return $this->FunctionDeclaration();
} else {
$this->syntaxError("'.' or '('");
}

View File

@ -482,6 +482,16 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
$this->assertValidDQL('SELECT u, u.id + ?1 AS someNumber FROM Doctrine\Tests\Models\CMS\CmsUser u');
}
/**
* @group DDC-1091
*/
public function testCustomFunctionsReturningStringInStringPrimary()
{
$this->_em->getConfiguration()->addCustomStringFunction('CC', 'Doctrine\ORM\Query\AST\Functions\ConcatFunction');
$this->assertValidDQL("SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE CC('%', u.name) LIKE '%foo%'", true);
}
/**
* @group DDC-505
*/