Exemple #1
0
 /**
  * parseComonents 
  * 
  * @param array $queryComponents 
  * @access public
  * @return void
  */
 public function parseHttpQueryComponents(array $queryComponents = array())
 {
     $statement = new Statement();
     foreach ($queryComponents as $key => $part) {
         $clause = $this->getClauseForHttpQueryKey($key);
         $statement->setClause($clause, $this->parseClause($part, $clause));
     }
     return $statement;
 }
Exemple #2
0
 public function visitStatement(Expr\Statement $statement)
 {
     foreach ($this->visitors as $visitor) {
         $statement->dispatch($visitor);
     }
     // traverse tree
     foreach ($statement->getClauses() as $clause) {
         $clause->dispatch($this);
     }
 }
Exemple #3
0
 public function visitStatement(Expr\Statement $statement)
 {
     $this->reset();
     // apply condition
     if ($statement->hasClause('condition')) {
         $this->queryComponents['query'] = $this->visitConditionalClause($statement->getClause('condition'));
     }
     // apply order
     if ($statement->hasClause('order')) {
         $this->queryComponents['order'] = $this->visitOrderClause($statement->getClause('order'));
     }
 }
Exemple #4
0
 /**
  * parse 
  *   Parse fields criteria and order
  * @param array $criteria 
  * @param array $order 
  * @access public
  * @return void
  */
 public function parse(array $criteria, array $orderBy = array(), $limit = null, $offset = null)
 {
     $statement = new Expr\Statement();
     if (!empty($criteria)) {
         $statement->setClause('condition', $this->parseCriteria($criteria));
     }
     if (!empty($orderBy)) {
         $statement->setClause('order', $this->parseOrderBy($orderBy));
     }
     if ($limit) {
         $statement->setClause('limit', $this->parseLimit($limit));
     }
     if ($offset) {
         $statement->setClause('offset', $this->parseOffset($offset));
     }
     return new Query($statement, $this->persister);
 }
Exemple #5
0
 public function visitStatement(Expr\Statement $statement)
 {
     $this->reset();
     $qb = $this->getQueryBuilder();
     // apply
     if ($statement->hasClause('condition')) {
         $this->visitConditionalClause($statement->getClause('condition'));
     }
     if ($statement->hasClause('order')) {
         $this->visitOrderClause($statement->getClause('order'));
     }
     if ($statement->hasClause('offset')) {
         $this->visitOffsetClause($statement->getClause('offset'));
     }
     if ($statement->hasClause('limit')) {
         $this->visitLimitClause($statement->getClause('limit'));
     }
 }