You are here

function Sql::build in Views (for Drupal 7) 8.3

Builds the necessary info to execute the query.

Overrides QueryPluginBase::build

File

lib/Drupal/views/Plugin/views/query/Sql.php, line 1411
Definition of Drupal\views\Plugin\views\query\Sql.

Class

Sql
@todo.

Namespace

Drupal\views\Plugin\views\query

Code

function build(ViewExecutable $view) {

  // Make the query distinct if the option was set.
  if (!empty($this->options['distinct'])) {
    $this
      ->set_distinct(TRUE);
  }

  // Store the view in the object to be able to use it later.
  $this->view = $view;
  $view
    ->initPager();

  // Let the pager modify the query to add limits.
  $view->pager
    ->query();
  $view->build_info['query'] = $this
    ->query();
  $view->build_info['count_query'] = $this
    ->query(TRUE);
}