Example #1
0
 /**
  * @return string
  */
 protected function buildQuery()
 {
     # first create extra join from statements with columns with referenced tables
     $statementsWithReferences = array('WHERE', 'SELECT', 'GROUP BY', 'ORDER BY');
     foreach ($statementsWithReferences as $clause) {
         if (array_key_exists($clause, $this->context->statements)) {
             $this->context->statements[$clause] = array_map(array($this, 'createUndefinedJoins'), $this->context->statements[$clause]);
         }
     }
     return parent::buildQuery();
 }
Example #2
0
 protected function buildQuery()
 {
     $this->init();
     return parent::buildQuery();
 }
Example #3
0
 /**
  * @param Query $query
  * @param bool $clone whether to create independent query (cloned context)
  * @return static
  */
 public static function fromQuery(Query $query, $clone = false)
 {
     $context = $query->getContext(false);
     return new static($clone && $context ? clone $context : $context);
 }