Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291936

Update Entity Timestamp if possible

$
0
0

Problem/Motivation

If the Entity used by an EntityResource implements `EntityChangedInterface` this is not updated when a patch method is used to update the entity via the rest API.

Steps to reproduce

Create an entity that implements EntityChangedInterface and a subclass of EntityResource which uses this Entity. Update the entity via the rest API, the updated timestamp is not modified.

Proposed resolution

This is a fairly simple enhancment

Before the entity is saved in the Patch method

if ($original_entity instanceof EntityChangedInterface) {
      $original_entity->setChangedTime(time());
    }

This is a core interface so it would be nice to see it supported.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None


Viewing all articles
Browse latest Browse all 291936

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>