Condition.php

Same filename in this branch
  1. 11.x core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/Condition.php
  2. 11.x core/lib/Drupal/Core/Config/Entity/Query/Condition.php
  3. 11.x core/lib/Drupal/Core/Database/Query/Condition.php
  4. 11.x core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
  5. 11.x core/lib/Drupal/Core/Entity/Query/Null/Condition.php
  6. 11.x core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php
  7. 11.x core/lib/Drupal/Core/Condition/Attribute/Condition.php
  8. 11.x core/lib/Drupal/Core/Condition/Annotation/Condition.php
  9. 11.x core/modules/pgsql/src/EntityQuery/Condition.php
Same filename and directory in other branches
  1. 9 core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/Condition.php
  2. 9 core/lib/Drupal/Core/Config/Entity/Query/Condition.php
  3. 9 core/lib/Drupal/Core/Database/Query/Condition.php
  4. 9 core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
  5. 9 core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php
  6. 9 core/lib/Drupal/Core/Entity/Query/Null/Condition.php
  7. 9 core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php
  8. 9 core/lib/Drupal/Core/Condition/Annotation/Condition.php
  9. 8.9.x core/lib/Drupal/Core/Config/Entity/Query/Condition.php
  10. 8.9.x core/lib/Drupal/Core/Database/Query/Condition.php
  11. 8.9.x core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
  12. 8.9.x core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php
  13. 8.9.x core/lib/Drupal/Core/Entity/Query/Null/Condition.php
  14. 8.9.x core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php
  15. 8.9.x core/lib/Drupal/Core/Condition/Annotation/Condition.php
  16. 10 core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/Condition.php
  17. 10 core/lib/Drupal/Core/Config/Entity/Query/Condition.php
  18. 10 core/lib/Drupal/Core/Database/Query/Condition.php
  19. 10 core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
  20. 10 core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php
  21. 10 core/lib/Drupal/Core/Entity/Query/Null/Condition.php
  22. 10 core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php
  23. 10 core/lib/Drupal/Core/Condition/Attribute/Condition.php
  24. 10 core/lib/Drupal/Core/Condition/Annotation/Condition.php

Namespace

Drupal\Core\Entity\Query\Sql\pgsql

File

core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php

View source
<?php

namespace Drupal\Core\Entity\Query\Sql\pgsql;

use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Entity\Query\Sql\Condition as BaseCondition;
@trigger_error('\\Drupal\\Core\\Entity\\Query\\Sql\\pgsql\\Condition is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. The PostgreSQL override of the entity query has been moved to the pgsql module. See https://www.drupal.org/node/3488580', E_USER_DEPRECATED);

/**
 * Implements entity query conditions for PostgreSQL databases.
 *
 * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. The
 *   PostgreSQL override of the entity query has been moved to the pgsql module.
 *
 * @see https://www.drupal.org/node/3488580
 */
class Condition extends BaseCondition {
  
  /**
   * {@inheritdoc}
   */
  public static function translateCondition(&$condition, SelectInterface $sql_query, $case_sensitive) {
    if (is_array($condition['value']) && $case_sensitive === FALSE) {
      $condition['where'] = 'LOWER(' . $sql_query->escapeField($condition['real_field']) . ') ' . $condition['operator'] . ' (';
      $condition['where_args'] = [];
      // Only use the array values in case an associative array is passed as an
      // argument following similar pattern in
      // \Drupal\Core\Database\Connection::expandArguments().
      $where_prefix = str_replace('.', '_', $condition['real_field']);
      foreach ($condition['value'] as $key => $value) {
        $where_id = $where_prefix . $key;
        $condition['where'] .= 'LOWER(:' . $where_id . '),';
        $condition['where_args'][':' . $where_id] = $value;
      }
      $condition['where'] = trim($condition['where'], ',');
      $condition['where'] .= ')';
    }
    parent::translateCondition($condition, $sql_query, $case_sensitive);
  }

}

Classes

Title Deprecated Summary
Condition

in drupal:11.2.0 and is removed from drupal:12.0.0. The PostgreSQL override of the entity query has been moved to the pgsql module.

Implements entity query conditions for PostgreSQL databases.

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