Accesscheck needs to be set

Created on 18 October 2023, about 1 year ago

Problem/Motivation

When using Komponent with Layout Builder you get an error using Komponent:

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 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php)

Proposed resolution

Add accessCheck(TRUE) to query:

  private function getBlockIdFromRevisionId($revision_id) {
    $query = $this->entityTypeManager->getStorage('block_content')->getQuery()
      ->condition('revision_id', $revision_id)
      ->accessCheck(TRUE);

    $result = $query->execute();

    return reset($result);
  }
๐Ÿ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ธ๐Ÿ‡ชSweden MiSc

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024