. */ namespace Doctrine\ORM\Query\AST\Functions; /** * "SUBSTRING" "(" StringPrimary "," SimpleArithmeticExpression "," SimpleArithmeticExpression ")" * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.org * @since 2.0 * @version $Revision: 3938 $ * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel */ class SubstringFunction extends FunctionNode { public $stringPrimary; public $firstSimpleArithmeticExpression; public $secondSimpleArithmeticExpression; /** * @override */ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) { //TODO: Use platform to get SQL return 'SUBSTRING(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->firstSimpleArithmeticExpression) . ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->secondSimpleArithmeticExpression) . ')'; } /** * @override */ public function parse(\Doctrine\ORM\Query\Parser $parser) { $lexer = $parser->getLexer(); $parser->match($lexer->lookahead['value']); $parser->match('('); $this->stringPrimary = $parser->StringPrimary(); $parser->match(','); $this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $parser->match(','); $this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $parser->match(')'); } }