batch process crashes if an entity type has no entities

Created on 30 April 2024, 2 months ago
Updated 24 May 2024, about 1 month ago

Problem/Motivation

If an entity type has no entities, the batch process crashes with:

> An error occurred while processing \Drupal\entity_usage\EntityUsageBatchManager::updateSourcesBatchWorker with arguments : \Drupal\entity_usage\EntityUsageBatchManager::updateSourcesBatchWorker

although the actual problem is that the entity storage tried to load an entity with id FALSE.

This is because of this:

    $entity_id = reset($entity_ids);

    if (isset($entity_id) && $entity = $entity_storage->load($entity_id)) {

reset([]) is FALSE, so the isset() check is not working as intended.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom joachim

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024