Problem/Motivation

The "message subscribe example/email" sub-modules are active and I need to use content moderation/workflow modules. But during a moderation process, for example, when I change the status from draft to published, I get the following error.

php

Drupal\Core\Entity\EntityStorageException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /home/jayden/web/j10/public_html/drupal10/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

-----------------
node

Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Query\Sql\Query->prepare() (line 141 of /home/jayden/web/j10/public_html/drupal10/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

When I deactivate the message subscribe example module or the "node update" section within it, the transition completes successfully.
Of course, node update message cannot be created in this case.

Any ideas of using it with Content Moderation, please ?

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

Anonymous’s picture

jaydenpearly created an issue. See original summary.

Anonymous’s picture

a temporary solution that I'm not sure is sufficient. (message_subscribe_example.module)
-----------

Change
$query->condition($field . '.target_id', $entity->id());

with

$query->accessCheck(TRUE)->condition($field . '.target_id', $entity->id());

bluegeek9 made their first commit to this issue’s fork.

  • bluegeek9 committed 5fc798f8 on 8.x-1.x
    Issue #3386201: Entity queries must explicitly set whether the query...
bluegeek9’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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