function db_condition

Same name in other branches
  1. 7.x includes/database/database.inc \db_condition()

Returns a new DatabaseCondition, set to the specified conjunction.

Internal API function call. Creating a \Drupal\Core\Database\Query\Condition object, specifying the desired conjunction ('AND', 'OR' or 'XOR'), is preferred.

Parameters

string $conjunction: The conjunction to use for query conditions (AND, OR or XOR).

Return value

\Drupal\Core\Database\Query\Condition A new Condition object, set to the specified conjunction.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Create a \Drupal\Core\Database\Query\Condition object, specifying the desired conjunction: new Condition($conjunction);

See also

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

\Drupal\Core\Database\Query\Condition

Related topics

1 call to db_condition()
DatabaseLegacyTest::testDbCondition in core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php
Tests deprecation of the db_condition() function.

File

core/includes/database.inc, line 596

Code

function db_condition($conjunction) {
    @trigger_error('db_condition() is deprecated in drupal:8.0.0. It will be removed from drupal:9.0.0. Create a \\Drupal\\Core\\Database\\Query\\Condition object, specifying the desired conjunction: new Condition($conjunction), instead. See https://www.drupal.org/node/2993033', E_USER_DEPRECATED);
    return new Condition($conjunction);
}

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