protected function GroupByNumeric::opBetween

Overrides Numeric::opBetween

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/filter/GroupByNumeric.php, line 30
Definition of Drupal\views\Plugin\views\filter\GroupByNumeric.

Class

GroupByNumeric
Simple filter to handle greater than/less than filters

Namespace

Drupal\views\Plugin\views\filter

Code

protected function opBetween($field) {
  $placeholder_min = $this
    ->placeholder();
  $placeholder_max = $this
    ->placeholder();
  if ($this->operator == 'between') {
    $this->query
      ->addHavingExpression($this->options['group'], "{$field} >= {$placeholder_min}", array(
      $placeholder_min => $this->value['min'],
    ));
    $this->query
      ->addHavingExpression($this->options['group'], "{$field} <= {$placeholder_max}", array(
      $placeholder_max => $this->value['max'],
    ));
  }
  else {
    $this->query
      ->addHavingExpression($this->options['group'], "{$field} <= {$placeholder_min} OR {$field} >= {$placeholder_max}", array(
      $placeholder_min => $this->value['min'],
      $placeholder_max => $this->value['max'],
    ));
  }
}