Problem/Motivation

When trying to display content that uses this module throws the following error:

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 /var/www/docroot/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

Proposed resolution

Looks like it's in Content.php in this query

$query = \Drupal::entityQuery('date_content')
        ->condition('type', $bundle)
        ->condition('parent_id', $entity->id())
        ->condition('parent_type', $entity->getEntityTypeId())
        ->condition('field_name', $field_name)
        ->condition('field_delta', $options['delta'])
      $existing = $query->execute();

MR headed your way here in a minute.

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

josh.fabean created an issue. See original summary.

mandclu’s picture

Status: Active » Needs review

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

keshavv’s picture

It was missing one another entityQuery
Added that into MR as well.

dgwolf’s picture

Seems the issue comes up here as well after upgrading to D10. Any news about the patch? Best, Andreas

Here's my error message on a newly updated Drupal install (9.5.11 -> 10.1.4) when trying to view an event as product in commerce:

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

Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 86)
Drupal\date_content\Plugin\DateAugmenter\Content->augmentOutput() (Line: 835)
Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateDefaultFormatter->augmentOutput() (Line: 155)
Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateDefaultFormatter->viewElements() (Line: 89)
Drupal\Core\Field\FormatterBase->view() (Line: 265)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple() (Line: 268)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple() (Line: 339)
Drupal\Core\Entity\EntityViewBuilder->buildComponents() (Line: 281)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 238)
Drupal\Core\Entity\EntityViewBuilder->build()
call_user_func() (Line: 37)
Drupal\commerce_product\ProductVariationFieldRenderer->renderFields() (Line: 60)
Drupal\commerce_product\ProductVariationFieldRendererLayoutBuilder->renderFields() (Line: 96)
Drupal\commerce_product\ProductViewBuilder->alterBuild() (Line: 291)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 238)
Drupal\Core\Entity\EntityViewBuilder->build()
call_user_func_array() (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 797)
Drupal\Core\Render\Renderer->doCallback() (Line: 386)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 239)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 187)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 191)
Drupal\page_cache\StackMiddleware\PageCache->fetch() (Line: 128)
Drupal\page_cache\StackMiddleware\PageCache->lookup() (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 50)
Drupal\ban\BanMiddleware->handle() (Line: 270)
Drupal\shield\ShieldMiddleware->bypass() (Line: 226)
Drupal\shield\ShieldMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

dgwolf’s picture

Had issues with my upgrade from D 9.5.11 to 10.1.14 but after a clean replay of the upgrade the problem persists. Using the module makes the page using it crash with said error messages. Unchecking "Enabled Date Augmenters" - "Content" in the display section of the page's Smart Date field disables the module and the page loads properly.

mandclu’s picture

@dgwolf did you try patching it with the changes in the MR?

dgwolf’s picture

Thanks for encouraging me to try the patch. It works, the page loads without a glitch. +1 for the MR!

mandclu’s picture

Status: Needs review » Fixed

I'll take that feedback as an RTBC, so merged in the changes. Will roll a new release shortly.

Status: Fixed » Closed (fixed)

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