You are here

function EntityNumeric::query in EntityFieldQuery Views Backend 8

Set up the query for this argument.

The argument sent may be found at $this->argument.

Overrides Numeric::query

1 method overrides EntityNumeric::query()
EntityFieldNumeric::query in src/Plugin/views/argument/EntityFieldNumeric.php
Set up the query for this argument.

File

src/Plugin/views/argument/EntityNumeric.php, line 24
Definition of Drupal\efq_views\Plugin\views\argument\EntityNumeric.

Class

EntityNumeric
Numeric argument handler for entity properties.

Namespace

Drupal\efq_views\Plugin\views\argument

Code

function query($group_by = false) {
  if (!empty($this->options['break_phrase'])) {
    views_break_phrase($this->argument, $this);
  }
  else {
    $this->value = array(
      $this->argument,
    );
    $this->operator = 'and';
  }
  if (count($this->value) > 1 && $this->operator == 'or') {
    $operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
    $this->query->query
      ->propertyCondition($this->real_field, $this->value, $operator);
  }
  else {
    $operator = empty($this->options['not']) ? '=' : '!=';
    foreach ($this->value as $value) {
      $this->query->query
        ->propertyCondition($this->real_field, $value, $operator);
    }
  }
}