Currently, for update and create ops, the clean controller saves a wrapper and then returns the same wrappert. This is problematic because the wrapper caches properties, so if any are modified during the save operation -- e.g. via hook_entity_insert() or _update() -- they will not be reflected inthe wrapper, and thus the representation will not be accurate. Further, the "retrieve" method for some entities modifies the representation directly (e.g. for users, we remove sensitive data).

It is preferable that update and create operations return a representation of the resource which matches exactly that which would be returned by a subsequent "retrieve" operation.

The patch to follow ensures this by invoking the controller's retrieve() method to generate the representation after update or create.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wodenx’s picture

Status: Active » Needs review
FileSize
1.57 KB

Status: Needs review » Needs work

The last submitted patch, 1: 2202865-1-services_entity-create-and-update-return.patch, failed testing.

wodenx’s picture

Status: Needs work » Needs review
FileSize
1.56 KB

Previous patch was generated on top of some other patches and so it wouldn't apply cleanly.

wodenx’s picture

Updating tag.