function UserUid::query

Same name in this branch
  1. 10 core/modules/tracker/src/Plugin/views/filter/UserUid.php \Drupal\tracker\Plugin\views\filter\UserUid::query()
  2. 10 core/modules/tracker/src/Plugin/views/argument/UserUid.php \Drupal\tracker\Plugin\views\argument\UserUid::query()
  3. 10 core/modules/comment/src/Plugin/views/filter/UserUid.php \Drupal\comment\Plugin\views\filter\UserUid::query()
Same name in other branches
  1. 9 core/modules/tracker/src/Plugin/views/filter/UserUid.php \Drupal\tracker\Plugin\views\filter\UserUid::query()
  2. 9 core/modules/tracker/src/Plugin/views/argument/UserUid.php \Drupal\tracker\Plugin\views\argument\UserUid::query()
  3. 9 core/modules/comment/src/Plugin/views/filter/UserUid.php \Drupal\comment\Plugin\views\filter\UserUid::query()
  4. 9 core/modules/comment/src/Plugin/views/argument/UserUid.php \Drupal\comment\Plugin\views\argument\UserUid::query()
  5. 8.9.x core/modules/tracker/src/Plugin/views/filter/UserUid.php \Drupal\tracker\Plugin\views\filter\UserUid::query()
  6. 8.9.x core/modules/tracker/src/Plugin/views/argument/UserUid.php \Drupal\tracker\Plugin\views\argument\UserUid::query()
  7. 8.9.x core/modules/comment/src/Plugin/views/filter/UserUid.php \Drupal\comment\Plugin\views\filter\UserUid::query()
  8. 8.9.x core/modules/comment/src/Plugin/views/argument/UserUid.php \Drupal\comment\Plugin\views\argument\UserUid::query()
  9. 11.x core/modules/tracker/src/Plugin/views/filter/UserUid.php \Drupal\tracker\Plugin\views\filter\UserUid::query()
  10. 11.x core/modules/tracker/src/Plugin/views/argument/UserUid.php \Drupal\tracker\Plugin\views\argument\UserUid::query()
  11. 11.x core/modules/comment/src/Plugin/views/filter/UserUid.php \Drupal\comment\Plugin\views\filter\UserUid::query()
  12. 11.x core/modules/comment/src/Plugin/views/argument/UserUid.php \Drupal\comment\Plugin\views\argument\UserUid::query()

Overrides ArgumentPluginBase::query

1 method overrides UserUid::query()
UserUid::query in core/modules/tracker/src/Plugin/views/argument/UserUid.php
Set up the query for this argument.

File

core/modules/comment/src/Plugin/views/argument/UserUid.php, line 82

Class

UserUid
The views user ID argument handler.

Namespace

Drupal\comment\Plugin\views\argument

Code

public function query($group_by = FALSE) {
    $this->ensureMyTable();
    // Use the table definition to correctly add this user ID condition.
    if ($this->table != 'comment_field_data') {
        $subselect = $this->database
            ->select('comment_field_data', 'c');
        $subselect->addField('c', 'cid');
        $subselect->condition('c.uid', $this->argument);
        $entity_id = $this->definition['entity_id'];
        $entity_type = $this->definition['entity_type'];
        $subselect->where("[c].[entity_id] = [{$this->tableAlias}].[{$entity_id}]");
        $subselect->condition('c.entity_type', $entity_type);
        $condition = $this->view->query
            ->getConnection()
            ->condition('OR')
            ->condition("{$this->tableAlias}.uid", $this->argument, '=')
            ->exists($subselect);
        $this->query
            ->addWhere(0, $condition);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.