-
-
Save doctrinebot/af75b56e37ac54349a45 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-1091 - https://github.com/doctrine/doctrine2/issues/1686
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\ORM\Query\Lexer; | |
use Doctrine\ORM\Query\AST\Functions\FunctionNode; | |
class bDqlNvl extends FunctionNode { | |
public $field; | |
public $fallback; | |
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) { | |
return 'NVL(' . | |
$this->field->dispatch($sqlWalker) . ', ' . | |
$this->fallback->dispatch($sqlWalker) . | |
')'; | |
} | |
public function parse(\Doctrine\ORM\Query\Parser $parser) { | |
$parser->match(Lexer::T_IDENTIFIER); | |
$parser->match(Lexer::T_OPEN_PARENTHESIS); | |
$this->field = $parser->StringPrimary(); | |
$parser->match(Lexer::T_COMMA); | |
$this->fallback = $parser->StringPrimary(); | |
$parser->match(Lexer::T_CLOSE_PARENTHESIS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment