You are here

public function Condition::where in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition::where()
  2. 9 core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition::where()

Adds an arbitrary WHERE clause to the query.

Parameters

string $snippet: A portion of a WHERE clause as a prepared statement. It must use named placeholders, not ? placeholders. The caller is responsible for providing unique placeholders that do not interfere with the placeholders generated by this QueryConditionInterface object.

array $args: An associative array of arguments keyed by the named placeholders.

Return value

$this The called object.

Overrides ConditionInterface::where

1 call to Condition::where()
Condition::alwaysFalse in core/lib/Drupal/Core/Database/Query/Condition.php
Sets a condition that is always false.

File

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

Class

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

Namespace

Drupal\Core\Database\Query

Code

public function where($snippet, $args = []) {
  $this->conditions[] = [
    'field' => $snippet,
    'value' => $args,
    'operator' => NULL,
  ];
  $this->changed = TRUE;
  return $this;
}