- Issue created by @dieterholvoet
- First commit to issue fork.
- π·π΄Romania amateescu
I've wanted to rewrite the entity query alters for a long time, and now that we have
hook_entity_query_alter()
in Drupal 10.3, I think it's time to bite the bullet and start using it :) -
amateescu β
committed 236a8916 on 3.x
Issue #3465014 by amateescu: Refactor entity query handling
-
amateescu β
committed 236a8916 on 3.x
- π·π΄Romania amateescu
My excitement with
hook_entity_query_alter()
was very short-lived.. core doesn't support it for aggregate queries, so I had to bring back most the ugly code I was trying to remove :/But the MR is still a slight improvement and easier to cleanup when the time comes, so merged into 3.x.
- π·π΄Romania amateescu
If anyone is interested, I opened a core issue to fix the missing bits: π Aggregate entity queries are missing the alter hooks Active
- πΊπΈUnited States Maeglin
It looks like something is still looking for the old Query class. I'm getting warnings similar to the following whenever a page loads after installing the latest update. This is after clearing the cache... twice.
Warning: include(/var/www/drupal/web/modules/contrib/trash/src/EntityQuery/Sql/Query.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/drupal/vendor/composer/ClassLoader.php)
#0 /var/www/drupal/web/core/includes/bootstrap.inc(108): _drupal_error_handler_real()
#1 /var/www/drupal/vendor/composer/ClassLoader.php(576): _drupal_error_handler()
#2 /var/www/drupal/vendor/composer/ClassLoader.php(576): include('...')
#3 /var/www/drupal/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}()
#4 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#5 /var/www/drupal/web/core/lib/Drupal/Core/Entity/Query/QueryBase.php(507): class_exists()
#6 /var/www/drupal/web/core/lib/Drupal/Core/Entity/Query/Sql/QueryFactory.php(50): Drupal\Core\Entity\Query\QueryBase::getClass()
#7 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(625): Drupal\Core\Entity\Query\Sql\QueryFactory->get()
#8 /var/www/drupal/web/core/modules/block_content/src/BlockContentUuidLookup.php(49): Drupal\Core\Entity\EntityStorageBase->getQuery()
#9 /var/www/drupal/web/core/lib/Drupal/Core/Cache/CacheCollector.php(148): Drupal\block_content\BlockContentUuidLookup->resolveCacheMiss()
#10 /var/www/drupal/web/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php(211): Drupal\Core\Cache\CacheCollector->get()
#11 /var/www/drupal/web/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php(178): Drupal\block_content\Plugin\Block\BlockContentBlock->getEntity()
#12 /var/www/drupal/web/core/lib/Drupal/Core/Block/BlockPluginTrait.php(127): Drupal\block_content\Plugin\Block\BlockContentBlock->blockAccess()
#13 /var/www/drupal/web/core/modules/block/src/BlockAccessControlHandler.php(124): Drupal\Core\Block\BlockBase->access()
#14 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(109): Drupal\block\BlockAccessControlHandler->checkAccess()
#15 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityBase.php(329): Drupal\Core\Entity\EntityAccessControlHandler->access()
#16 /var/www/drupal/web/core/modules/block/src/BlockRepository.php(63): Drupal\Core\Entity\EntityBase->access()
#17 /var/www/drupal/web/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php(138): Drupal\block\BlockRepository->getVisibleBlocksPerRegion()
#18 /var/www/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(270): Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build()
#19 /var/www/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#20 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#21 /var/www/drupal/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#22 /var/www/drupal/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}()
#23 /var/www/drupal/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#24 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(188): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#25 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#26 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#27 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#28 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#29 /var/www/drupal/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#30 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#31 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#32 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#33 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#34 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#35 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#36 /var/www/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#37 /var/www/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#38 {main} - π·π΄Romania amateescu
@maeglin, that looks like an apcu/file cache issue, have you tried restarting the web server? Or deleting the
trash
module's directory and reinstalling it with composer? Automatically closed - issue fixed for 2 weeks with no activity.