/**
  * {@inheritdoc}
  */
 public function configureSelector(RecordSelector $selector)
 {
     if (empty($this->loaders) && empty($this->joiners)) {
         //No need to create any column aliases
         return;
     }
     parent::configureSelector($selector);
 }
 /**
  * {@inheritdoc}
  */
 public function sqlStatement(QueryCompiler $compiler = null)
 {
     if (empty($compiler)) {
         $compiler = $this->compiler->resetQuoter();
     }
     //Primary loader may add custom conditions to select query
     $this->loader->configureSelector($this);
     if (empty($columns = $this->columns)) {
         //If no user columns were specified we are going to use columns defined by our loaders
         //in addition it will return RecordIterator instance as result instead of QueryResult
         $columns = !empty($this->dataColumns) ? $this->dataColumns : ['*'];
     }
     return $compiler->compileSelect(["{$this->primaryTable()} AS {$this->primaryAlias()}"], $this->distinct, $columns, $this->joinTokens, $this->whereTokens, $this->havingTokens, $this->grouping, $this->ordering, $this->limit, $this->offset);
 }
Exemple #3
0
 /**
  * Create delete statement based on WHERE statement provided by Selector.
  *
  * @param QueryCompiler $compiler
  * @return string
  */
 protected function deleteStatement(QueryCompiler $compiler = null)
 {
     $compiler = !empty($compiler) ? $compiler : $this->compiler->reset();
     $this->loader->configureSelector($this, false);
     return $compiler->delete($this->loader->getTable() . ' AS ' . $this->loader->getAlias(), $this->whereTokens);
 }