Problem/Motivation

#3370639: Prevent trashed entities from being returned by entity_load during updates can be problematic. E.g. if I need to alter N entities in a hook_update_N/post_udpdate (or a contrib module does), the trashed entities won't be affected.

This is a case-per-case decision, but I think the safer bet is including trashed entities by default.

Proposed resolution

Per amateescu, we can hook into the update kernel and switch to the 'ignore' trash context during updates by default.

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Issue fork trash-3398794

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

penyaskito created an issue. See original summary.

penyaskito’s picture

Priority: Normal » Major

This might be a release blocker too.

penyaskito’s picture

@amateescu I've never done this before, should it be in ServiceProvider like WorkspacesServiceProvider does?

amateescu’s picture

Looked a bit into this and it seems we need an event subscriber that reacts to the KernelEvents::REQUEST event, checks whether $event->getKernel() instanceof UpdateKernel and sets the trash context on the trash manager to inactive.

penyaskito’s picture

Status: Active » Needs review

That looks definitely cleaner. Created MR with proposed solution.

amateescu’s picture

Status: Needs review » Fixed

Merged into 3.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.