. */ namespace Doctrine\ORM\Query\AST\Functions; use Doctrine\ORM\Query\Lexer; /** * "CONCAT" "(" StringPrimary "," StringPrimary {"," StringPrimary }* ")" * * * @link www.doctrine-project.org * @since 2.0 * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel * @author Benjamin Eberlei */ class ConcatFunction extends FunctionNode { public $firstStringPrimary; public $secondStringPrimary; public $concatExpressions = array(); /** * @override */ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) { $platform = $sqlWalker->getConnection()->getDatabasePlatform(); $args = array(); foreach ($this->concatExpressions as $expression) { $args[] = $sqlWalker->walkStringPrimary($expression); } return call_user_func_array(array($platform,'getConcatExpression'), $args); } /** * @override */ public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->firstStringPrimary = $parser->StringPrimary(); $this->concatExpressions[] = $this->firstStringPrimary; $parser->match(Lexer::T_COMMA); $this->secondStringPrimary = $parser->StringPrimary(); $this->concatExpressions[] = $this->secondStringPrimary; while ($parser->getLexer()->isNextToken(Lexer::T_COMMA)) { $parser->match(Lexer::T_COMMA); $this->concatExpressions[] = $parser->StringPrimary(); } $parser->match(Lexer::T_CLOSE_PARENTHESIS); } }