Calling Drupal\Core\Database\Query\Condition::condition() without an array compatible operator is not supported

Created on 22 January 2025, 8 months ago

Problem/Motivation

I patched views_taxonomy_term_name_depth so that I can use it on my Drupal 11 wbsite.

When running views_taxonomy_term_name_depth on Drupal 11 I get the following error:

The website encountered an unexpected error. Try again later.

Drupal\Core\Database\InvalidQueryException: Calling Drupal\Core\Database\Query\Condition::condition() without an array compatible operator is not supported. See https://www.drupal.org/node/3350985 in Drupal\Core\Database\Query\Condition->condition() (line 115 of core/lib/Drupal/Core/Database/Query/Condition.php).
Drupal\views_taxonomy_term_name_depth\Plugin\views\argument\IndexNameDepth->query() (Line: 1171)
Drupal\views\ViewExecutable->_buildArguments() (Line: 1327)
Drupal\views\ViewExecutable->build() (Line: 1451)
Drupal\views\ViewExecutable->execute() (Line: 1514)

See https://www.drupal.org/node/3350985

In src/Plugin/views/argument/IndexNameDepth.php the operator is chosen based on the amount of items available:

$operator = (count($break->value) > 1) ? 'IN' : '=';

If there is 1 item then the operator is '='. This is not allowed in D11

🐛 Bug report
Status

Active

Version

7.0

Component

Code

Created by

🇳🇱Netherlands batigolix Utrecht

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024