function Condition::mapConditionOperator

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition::mapConditionOperator()
  2. 8.9.x core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition::mapConditionOperator()
  3. 11.x core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition::mapConditionOperator()

Gets any special processing requirements for the condition operator.

Some condition types require special processing, such as IN, because the value data they pass in is not a simple value. This is a simple overridable lookup function.

Parameters

string $operator: The condition operator, such as "IN", "BETWEEN", etc. Case-sensitive.

Return value

array The extra handling directives for the specified operator or an empty array if there are no extra handling directives.

1 call to Condition::mapConditionOperator()
Condition::compile in core/lib/Drupal/Core/Database/Query/Condition.php

File

core/lib/Drupal/Core/Database/Query/Condition.php, line 392

Class

Condition
Generic class for a series of conditions in a query.

Namespace

Drupal\Core\Database\Query

Code

protected function mapConditionOperator($operator) {
    if (isset(static::$conditionOperatorMap[$operator])) {
        $return = static::$conditionOperatorMap[$operator];
    }
    else {
        // We need to upper case because PHP index matches are case sensitive but
        // do not need the more expensive mb_strtoupper() because SQL statements
        // are ASCII.
        $operator = strtoupper($operator);
        $return = static::$conditionOperatorMap[$operator] ?? [];
    }
    $return += [
        'operator' => $operator,
    ];
    return $return;
}

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