Allow entity type and field storage definition objects to be compared for definition equality

Created on 11 September 2014, almost 11 years ago
Updated 1 May 2025, 4 months ago

Followup from #2333113: Add an EntityDefinitionUpdateManager so that entity handlers can respond (e.g., by updating db schema) to code updates in a controlled way (e.g., from update.php) β†’ . In that issue, we're introducing EntityDefinitionUpdateManager which checks when the current code-defined entity type and field storage definitions differ from what the EntityManager was last notified about (via onEntityTypeUpdate() or onFieldStorageDefinitionUpdate()), so that it can call those events during update.php in order for the entity handlers to be able to properly react to the new definitions.

Currently, EntityDefinitionUpdateManager limits itself to only checking whether the definition changes involve storage schema changes, since that's what we have an existing core use case of a handler that must react. However, in principle, there might be other handlers/listeners that also want to react, so ideally, we would invoke those update events whenever the definitions differ at all, not only for storage schema changes.

To accomplish that though, we need a way to compare the definition objects. A simple != doesn't work: it returns TRUE even when the objects aren't different in their definitions (perhaps there's some other unrelated difference in the object) and for some definitions, causes a PHP infinite recursion error.

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

entity system

Created by

πŸ‡ΊπŸ‡ΈUnited States effulgentsia

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    wanted to bump 1 more time.

Production build 0.71.5 2024