- Issue created by @ptmkenny
- 🇯🇵Japan ptmkenny
Full stacktrace:
Fatal error: Uncaught TypeError: Drupal\jsonapi_defaults\Controller\EntityResource::__construct(): Argument #12 ($jsonapi_defaults) must be of type Drupal\jsonapi_defaults\JsonapiDefaultsInterface, Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and defined in /var/www/html/web/modules/jsonapi_extras/modules/jsonapi_defaults/src/Controller/EntityResource.php:75 Stack trace: #0 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\jsonapi_defaults\Controller\EntityResource->__construct() #1 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService() #2 /var/www/html/web/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php(20): Drupal\Component\DependencyInjection\Container->get() #3 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityResolverManager.php(106): Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() #4 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityResolverManager.php(219): Drupal\Core\Entity\EntityResolverManager->getControllerClass() #5 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php(48): Drupal\Core\Entity\EntityResolverManager->setRouteOptions() #6 [internal function]: Drupal\Core\EventSubscriber\EntityRouteAlterSubscriber->onRoutingRouteAlterSetType() #7 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func() #8 /var/www/html/web/core/lib/Drupal/Core/Routing/RouteBuilder.php(189): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() #9 /var/www/html/web/core/lib/Drupal/Core/ProxyClass/Routing/RouteBuilder.php(83): Drupal\Core\Routing\RouteBuilder->rebuild() #10 /var/www/html/web/core/includes/common.inc(485): Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild() #11 /var/www/html/web/core/includes/utility.inc(41): drupal_flush_all_caches() #12 /var/www/html/vendor/drush/drush/src/Commands/core/CacheRebuildCommands.php(70): drupal_rebuild() #13 [internal function]: Drush\Commands\core\CacheRebuildCommands->rebuild() #14 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array() #15 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() #16 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() #17 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process() #18 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute() #19 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run() #20 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand() #21 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun() #22 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run() #23 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun() #24 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run() #25 /var/www/html/vendor/drush/drush/drush(4): require('...') #26 /var/www/html/vendor/bin/drush(119): include('...') #27 {main} thrown in /var/www/html/web/modules/jsonapi_extras/modules/jsonapi_defaults/src/Controller/EntityResource.php on line 75 [warning] Drush command terminated abnormally.
- last update
11 months ago 17 pass, 2 fail - Status changed to Needs review
11 months ago 5:16pm 2 June 2024 - 🇯🇵Japan ptmkenny
The eventDispatcher never got injected, but it is provided by core, so then in construct() all the arguments get out of order, breaking the site. This MR injects the eventDispatcher so that the parent constructor can be called properly.
33:47 32:02 Running29:59 28:03 Running- Status changed to Postponed
11 months ago 5:32pm 2 June 2024 - 🇯🇵Japan ptmkenny
So this issue was caused by me having applied the MR in ✨ Allow specifying `meta` data on JSON:API objects Needs work . When this issue eventually gets committed to core, the code will need to be updated, so I'm marking postponed for now. But feel free to close if you would rather handle this once the commit actually happens.