public function parse(Query\Parser $parser) { $parser->match(Query\Lexer::T_IDENTIFIER); $parser->match(Query\Lexer::T_OPEN_PARENTHESIS); $this->arg = $parser->ArithmeticPrimary(); $parser->match(Query\Lexer::T_CLOSE_PARENTHESIS); }
public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->arithmeticExpression = $parser->SimpleArithmeticExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * {@inheritdoc} */ public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->stringPrimary = $parser->StringPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * @override */ public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->pathExpression = $parser->SingleValuedAssociationPathExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->stringExpression = $parser->StringPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->date = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->dateExpression = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * {@inheritdoc} */ public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->parameters[self::PARAMETER_KEY] = $parser->SimpleArithmeticExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->value = $parser->SimpleArithmeticExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * @override */ public function parse(\Doctrine\ORM\Query\Parser $parser) { $lexer = $parser->getLexer(); $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->expressions[] = $parser->ArithmeticFactor(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * {@inheritdoc} */ public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->pathExpression = $parser->SingleValuedPathExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); //$this->datePart=$parser->StringPrimary(); $this->dateField = $parser->StateFieldPathExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); // (2) $parser->match(Lexer::T_OPEN_PARENTHESIS); // (3) $this->var1 = $parser->ConditionalExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); // (3) }
public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); // (2) $parser->match(Lexer::T_OPEN_PARENTHESIS); // (3) $this->dateExpression = $parser->ArithmeticExpression(); // (4) $parser->match(Lexer::T_CLOSE_PARENTHESIS); // (3) }
public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); // (2) $parser->match(Lexer::T_OPEN_PARENTHESIS); // (3) $this->expression = $parser->ArithmeticPrimary(); // (4) $parser->match(Lexer::T_CLOSE_PARENTHESIS); // (3) }
/** * @inheritdoc */ public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); // 'DATE' $parser->match(Lexer::T_OPEN_PARENTHESIS); // '(' $this->date = $parser->ArithmeticPrimary(); // the argument $parser->match(Lexer::T_CLOSE_PARENTHESIS); // ')' }
/** * @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(')'); }
/** * Feeds given parser with previously set literals * * @param Parser $parser */ protected function feedParserWithLiterals(Parser $parser) { $literalsMappingCount = count($this->literalsMapping); $lastLitteral = $literalsMappingCount - 1; for ($i = 0; $i < $literalsMappingCount; $i++) { $parserMethod = $this->literalsMapping[$i]; $this->literals[$i] = $parser->{$parserMethod}(); if ($i < $lastLitteral) { $parser->match(Lexer::T_COMMA); } } }
/** * @override */ public function parse(\Doctrine\ORM\Query\Parser $parser) { $lexer = $parser->getLexer(); $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->stringPrimary = $parser->StringPrimary(); $parser->match(Lexer::T_COMMA); $this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $parser->match(Lexer::T_COMMA); $this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * {@inheritdoc} */ public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->pathExpression = $parser->SingleValuedAssociationPathExpression(); if ($parser->getLexer()->isNextToken(Lexer::T_COMMA)) { $parser->match(Lexer::T_COMMA); $parser->match(Lexer::T_STRING); $this->fieldMapping = $parser->getLexer()->token['value']; } $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->fieldName = $parser->StringPrimary(); $parser->match(Lexer::T_COMMA); $this->queryString = $parser->StringPrimary(); if ($parser->getLexer()->lookahead['type'] == Lexer::T_COMMA) { $parser->match(Lexer::T_COMMA); $this->regconfig = $parser->StringPrimary(); } $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * {@inheritdoc} */ public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->parameters[self::SEPARATOR_KEY] = $parser->StringPrimary(); $parser->match(Lexer::T_COMMA); $this->parameters[self::STRINGS_KEY][] = $parser->StringPrimary(); while ($parser->getLexer()->isNextToken(Lexer::T_COMMA)) { $parser->match(Lexer::T_COMMA); $this->parameters[self::STRINGS_KEY][] = $parser->StringPrimary(); } $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * {@inheritDoc} */ public function feedParserWithLiterals(Parser $parser) { $lexer = $parser->getLexer(); $this->literals[] = $parser->{$this->commonLiteralMapping}(); $aheadType = $lexer->lookahead['type']; while (Lexer::T_CLOSE_PARENTHESIS !== $aheadType) { if (Lexer::T_COMMA === $aheadType) { $parser->match(Lexer::T_COMMA); $this->literals[] = $parser->{$this->commonLiteralMapping}(); } $aheadType = $lexer->lookahead['type']; } }
public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_IDENTIFIER); $lexer = $parser->getLexer(); $this->unit = $lexer->token['value']; $parser->match(Lexer::T_COMMA); $this->firstDatetimeExpression = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_COMMA); $this->secondDatetimeExpression = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * {@inheritdoc} */ public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->parameters['separator'] = $parser->StringPrimary(); $parser->match(Lexer::T_COMMA); $this->parameters['strings'][] = $parser->StringPrimary(); while ($parser->getLexer()->isNextToken(Lexer::T_COMMA)) { $parser->match(Lexer::T_COMMA); $this->parameters['strings'][] = $parser->StringPrimary(); } $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->expressions[] = $parser->ArithmeticFactor(); $parser->match(Lexer::T_COMMA); $this->expressions[] = $parser->ArithmeticFactor(); $lexer = $parser->getLexer(); if ($lexer->lookahead['type'] === Lexer::T_COMMA) { $parser->match(Lexer::T_COMMA); $this->expressions[] = $parser->ArithmeticFactor(); } $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * @override */ public function parse(\Doctrine\ORM\Query\Parser $parser) { $lexer = $parser->getLexer(); $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); if (strcasecmp('leading', $lexer->lookahead['value']) === 0) { $parser->match(Lexer::T_LEADING); $this->leading = true; } else { if (strcasecmp('trailing', $lexer->lookahead['value']) === 0) { $parser->match(Lexer::T_TRAILING); $this->trailing = true; } else { if (strcasecmp('both', $lexer->lookahead['value']) === 0) { $parser->match(Lexer::T_BOTH); $this->both = true; } } } if ($lexer->isNextToken(Lexer::T_STRING)) { $parser->match(Lexer::T_STRING); $this->trimChar = $lexer->token['value']; } if ($this->leading || $this->trailing || $this->both || $this->trimChar) { $parser->match(Lexer::T_FROM); } $this->stringPrimary = $parser->StringPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); }
/** * Calculates total count of query records * * @param Query $query * @param \Doctrine\Common\Collections\ArrayCollection|array|null $parameters Query parameters. * @return integer */ public function getCount(Query $query, $parameters = null) { if (!empty($parameters)) { $query = clone $query; $query->setParameters($parameters); } $parser = new Parser($query); $parserResult = $parser->parse(); $parameterMappings = $parserResult->getParameterMappings(); list($sqlParameters, $parameterTypes) = $this->processParameterMappings($query, $parameterMappings); $statement = $query->getEntityManager()->getConnection()->executeQuery('SELECT COUNT(*) FROM (' . $query->getSQL() . ') AS e', $sqlParameters, $parameterTypes); $result = $statement->fetchColumn(); return $result ? (int) $result : 0; }
/** * Parse the DQL * * @param \Doctrine\ORM\Query\Parser $parser */ public function parse(Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->firstDateExpression = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_COMMA); $parser->match(Lexer::T_IDENTIFIER); $this->intervalExpression = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_IDENTIFIER); /* @var $lexer Lexer */ $lexer = $parser->getLexer(); $this->unit = $lexer->token['value']; $parser->match(Lexer::T_CLOSE_PARENTHESIS); }