Error when trying to delete like or content

Created on 27 July 2023, over 1 year ago


Getting an error when I try to delete content or like in Drupal 10 :

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->delete() (line 761 of /homepages/12/d957135648/htdocs/ai-autopilot/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

It seems to be linked with this issue bit I don't know how to fix this problem :
https://www.drupal.org/node/3201242

💬 Support request
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇫🇷France alex.amtr

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

Comments & Activities

  • Issue created by @alex.amtr
  • Status changed to Postponed: needs info over 1 year ago
  • 🇪🇸Spain pcambra Asturies

    The two places I see we use a query are https://git.drupalcode.org/project/like/-/blob/2.x/src/LikeHelper.php#L187 and https://git.drupalcode.org/project/like/-/blob/2.x/src/LikeHelper.php#L211, and both use accesscheck already.

    Could you give me more details on the error?

  • 🇫🇷France alex.amtr

    Here is the detailed error I get when I try to delete a like :

    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->delete() (line 761 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
    Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 573)
    Drupal\likeit\LikeitHelper->removeFromEntity() (Line: 115)
    likeit_entity_delete()
    call_user_func_array() (Line: 409)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 388)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 416)
    Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 217)
    Drupal\Core\Entity\EntityStorageBase->invokeHook() (Line: 903)
    Drupal\Core\Entity\ContentEntityStorageBase->invokeHook() (Line: 462)
    Drupal\Core\Entity\EntityStorageBase->delete() (Line: 751)
    Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (Line: 347)
    Drupal\Core\Entity\EntityBase->delete() (Line: 71)
    Drupal\Core\Entity\ContentEntityDeleteForm->submitForm()
    call_user_func_array() (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 595)
    Drupal\Core\Form\FormBuilder->processForm() (Line: 323)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 74)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 675)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

  • Status changed to Closed: works as designed over 1 year ago
  • 🇪🇸Spain pcambra Asturies

    The error is being reported by https://www.drupal.org/project/likeit not this module

  • 🇫🇷France alex.amtr

    You're right !
    I didn't manage to make it run correctly and it blocked anything.
    I am sorry.
    Thank you for your help.

  • 🇪🇸Spain pcambra Asturies

    No problem, it is already closed :)

Production build 0.71.5 2024