Check if entity isNew() instead of the existence of the id() in _revision_log_default_get_original()

Created on 9 February 2024, 5 months ago

Problem/Motivation

_revision_log_default_get_original() checks if the entity has an id() to try to retrieve latest revision.

There are situation where the entity is new and might not have older revisions, like when migrating them, preserving IDs.

Would be more accurate to rely on isNew() method instead of the existence of the id value.

Steps to reproduce

Create moderated entities via migrate, preserving the ids in the original system as the original new IDs
Migration will throw PHP warning for every migrated entity:

[warning] array_flip(): Can only flip string and integer values, entry skipped ContentEntityStorageBase.php:667

Proposed resolution

Check $entity->isNew() instead if $entity->id() in _revision_log_default_get_original()

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

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