Query exception if no translations in active language

Created on 4 February 2023, almost 2 years ago
Updated 9 February 2023, almost 2 years ago

Problem/Motivation

If a language with no existing translation in any menu is activated in the pagetree, an InvalidQueryException is thrown:

Drupal\Core\Database\InvalidQueryException: Query condition 'nfr.vid IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (Zeile 117 in /var/www/public/core/lib/Drupal/Core/Database/Query/Condition.php).

This is due to line 261 in Service/Tree.php:
$query->condition('nfr.vid', $vids, 'IN');
where $vid is empty if there are no translations of any nodes in the language in the menus selected for the pagetree.

Proposed resolution

Skip language if getRevisionIds() returns an empty array.

Remaining tasks

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇭Switzerland pvbergen

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

Comments & Activities

Production build 0.71.5 2024