/**
  * {@inheritdoc}
  */
 public function query()
 {
     if ($this->operator === 'empty') {
         $this->query->condition($this->realField, NULL, '=', $this->options['group']);
     } elseif ($this->operator === 'not empty') {
         $this->query->condition($this->realField, NULL, '<>', $this->options['group']);
     } else {
         while (is_array($this->value)) {
             $this->value = $this->value ? reset($this->value) : NULL;
         }
         if (strlen($this->value) > 0) {
             $this->query->condition($this->realField, $this->value, $this->operator, $this->options['group']);
         }
     }
 }
Exemple #2
0
  /**
   * {@inheritdoc}
   */
  public function query($group_by = FALSE) {
    $this->fillValue();

    $condition_operator = empty($this->options['not']) ? '=' : '<>';

    if (count($this->value) > 1) {
      $filter = $this->query->createFilter(Unicode::strtoupper($this->operator));
      // $filter will be NULL if there were errors in the query.
      if ($filter) {
        foreach ($this->value as $value) {
          $filter->condition($this->realField, $value, $condition_operator);
        }
        $this->query->filter($filter);
      }
    }
    else {
      $this->query->condition($this->realField, reset($this->value), $condition_operator);
    }
  }