コード例 #1
0
 protected function parseAndApplyModifyOrderByWalker(\Doctrine\ORM\Query $query)
 {
     $parser = new \Doctrine\ORM\Query\Parser($query);
     $AST = $parser->QueryLanguage();
     $walker = new \abexto\xdc\orm\query\tools\ModifyOrderByWalker($query, null, []);
     $walker->walkSelectStatement($AST);
     return $AST;
 }
コード例 #2
0
 public function parseDql($dql, $hints = array())
 {
     $query = $this->_em->createQuery($dql);
     $query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true);
     $query->setDql($dql);
     foreach ($hints as $key => $value) {
         $query->setHint($key, $value);
     }
     $parser = new \Doctrine\ORM\Query\Parser($query);
     // We do NOT test SQL output here. That only unnecessarily slows down the tests!
     $parser->setCustomOutputTreeWalker('Doctrine\\Tests\\Mocks\\MockTreeWalker');
     return $parser->parse();
 }
コード例 #3
0
 /**
  * Parses the order by clause and transforms it into AST
  * @param string $orderByClause
  * @return \Doctrine\ORM\Query\AST\OrderByClause
  */
 protected function parseOrderByClause($orderByClause)
 {
     if ($orderByClause === '') {
         return new \Doctrine\ORM\Query\AST\OrderByClause([]);
         // Empty order by ===> RETURN
     }
     // We use the doctrine DQL parser here.
     // Fortunately the function OrderByClause is public, thus we can call it directly.
     // Let's hope that it stays public and never breaks
     $dummyQuery = $this->_getQuery()->getEntityManager()->createQuery('order by ' . $orderByClause);
     $parser = new \Doctrine\ORM\Query\Parser($dummyQuery);
     $parser->getLexer()->moveNext();
     // Move to first token
     return $parser->OrderByClause();
 }
コード例 #4
0
 protected function doParseWithoutCache()
 {
     $parser = new \Doctrine\ORM\Query\Parser($this->query);
     return $parser->parse();
 }