entities implementing EntityChangedInterface should have a 'changed' entity key

Created on 1 October 2025, 20 days ago
Updated 16 October 2025, 5 days ago

Problem/Motivation

Entity keys tell you how to get the common fields of different entity types that might have different specific field names. E.g. 'created', 'published', 'author'.

Entities which implement EntityChangedInterface are expected to have a field to store the changed timestamp, but there's no way to find out what that field is.

This affects code which needs to work at the field level rather than use the interface methods -- e.g. using JSONAPI data.

Steps to reproduce

Proposed resolution

Add a 'changed' entity key to core entity types which implement EntityChangedInterface.

  1. In the Drupal code base, lookup all content entity types that have EntityChangedInterface implemented.
  2. Per entity type, find out how the field is called that stores the changed timestamp.
  3. Define the new key in the annotation of the entity class, for example if the field is called "foo":
     *   entity_keys = {
    (...)
     *     "changed" = "foo",
     *   },
    

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

entity system

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

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.

No activities found.

Production build 0.71.5 2024