Problem/Motivation
If I set the current trash context to 'ignore', the code in \Drupal\trash\Hook\TrashEntityHooks::entityQueryAlter() still alters my query. Should it return as a no-op and not add any conditions when this is the case? I'd like to just manually add $query->addMetadata('trash', 'ignore') and not have to use \Drupal::service('trash.manager')->executeInTrashContext() as a wrapper.
Steps to reproduce
$query = \Drupal::entityTypeManager()->getQuery('node');
$query->addMetadata('trash', 'ignore');
$nids = $query->execute();
Confirm that $nids does not contain any trashed node IDs.
Proposed resolution
Have \Drupal\trash\Hook\TrashEntityHooks::entityQueryAlter() return without modifying the query when $query->getMetadata('trash') === 'ignore' without having to use executeInTrashContext()
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Issue fork trash-3579836
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
Comment #3
dave reidComment #6
amateescu commentedMakes sense, merged into 3.1.x and cherry-picked to 3.x, thanks!
The test failures are unrelated :)