function Condition::__construct

Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition::__construct()
  2. 10 core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition::__construct()
  3. 10 core/lib/Drupal/Core/Condition/Attribute/Condition.php \Drupal\Core\Condition\Attribute\Condition::__construct()
  4. 11.x core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition::__construct()
  5. 11.x core/lib/Drupal/Core/Condition/Attribute/Condition.php \Drupal\Core\Condition\Attribute\Condition::__construct()

Constructs a Condition object.

Parameters

string $conjunction: The operator to use to combine conditions: 'AND' or 'OR'.

bool $trigger_deprecation: If TRUE then trigger the deprecation warning.

Deprecated

in drupal:9.1.0 and is removed from drupal:10.0.0. Creating an instance of this class is deprecated.

See also

https://www.drupal.org/node/3159568

File

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

Class

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

Namespace

Drupal\Core\Database\Query

Code

public function __construct($conjunction, $trigger_deprecation = TRUE) {
    if ($trigger_deprecation) {
        @trigger_error('Creating an instance of this class is deprecated in drupal:9.1.0 and is removed in drupal:10.0.0. Use Database::getConnection()->condition() instead. See https://www.drupal.org/node/3159568', E_USER_DEPRECATED);
    }
    $this->conditions['#conjunction'] = $conjunction;
}

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