match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->firstDateExpression = $parser->ArithmeticFactor(); $parser->match(Lexer::T_COMMA); $this->intervalExpression = $parser->ArithmeticFactor(); $parser->match(Lexer::T_COMMA); $this->unit = $parser->StringPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); } public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) { $unit = strtoupper(is_string($this->unit) ? $this->unit : $this->unit->value); if (!in_array($unit, self::$allowedUnits)) { throw QueryException::semanticalError('DATE_ADD() does not support unit "' . $unit . '".'); } return 'DATE_ADD(' . $sqlWalker->walkArithmeticTerm($this->firstDateExpression) . ', INTERVAL ' . $sqlWalker->walkArithmeticTerm($this->intervalExpression) . ' ' . $unit . ')'; } }