getConditionOperator example


    return $errors;
  }

  /** * {@inheritdoc} */
  public function opEqual($expression) {
    // By default, things like opEqual uses add_where, that doesn't support     // complex expressions, so override opEqual (and all operators below).     $placeholder = $this->placeholder();
    $operator = $this->getConditionOperator($this->operator());
    $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => $this->value]);
  }

  protected function opContains($expression) {
    $placeholder = $this->placeholder();
    $operator = $this->getConditionOperator('LIKE');
    $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => '%' . $this->connection->escapeLike($this->value) . '%']);
  }

  /** * Filters by one or more words. * * By default opContainsWord uses add_where, that doesn't support complex * expressions. * * @param string $expression * The expression to add to the query. */

  }

  /** * Get the query operator. * * @return string * Returns LIKE or NOT LIKE or the database specific equivalent based on the * query's operator. */
  public function operator() {
    return $this->getConditionOperator($this->operator == '=' ? 'LIKE' : 'NOT LIKE');
  }

  /** * Get specified condition operator mapping value. * * @param string $operator * Condition operator. * * @return string * Specified condition operator mapping value. */
  
Home | Imprint | This part of the site doesn't use cookies.