Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I just updated to beta5, cleared cache, then I was going to enable commerce_log. When enable the module, the following error occurs:
The website encountered an unexpected error. Please try again later.
Error: Class 'Drupal\commerce_cart\Event\CartEvents' not found in Drupal\commerce_log\EventSubscriber\CartEventSubscriber::getSubscribedEvents() (line 35 of modules/commerce/modules/log/src/EventSubscriber/CartEventSubscriber.php).
Drupal\commerce_log\EventSubscriber\CartEventSubscriber::getSubscribedEvents() (Line: 37)
Drupal\Core\DependencyInjection\Compiler\RegisterEventSubscribersPass->process(Object) (Line: 104)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object) (Line: 590)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1254)
Drupal\Core\DrupalKernel->compileContainer() (Line: 866)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 790)
Drupal\Core\DrupalKernel->updateModules(Array, Array) (Line: 540)
Drupal\Core\Extension\ModuleInstaller->updateKernel(Array) (Line: 191)
Drupal\Core\Extension\ModuleInstaller->install(Array, 1) (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array) (Line: 450)
Drupal\system\Form\ModulesListForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('system_modules', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('system_modules', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
I don't have commerce_cart enabled. If this commerce_cart is an dependency, then we need to add it in commerce_log.info.yml; otherwise, there is more to fix.
Comment | File | Size | Author |
---|---|---|---|
#4 | commerce_log_crashes_if-2839426-4.patch | 1.1 KB | mglaman |
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedLooks like we can't have a service that depends on a module, cause each service is executed when the container is built.
I wanted to keep the event subscribers in the log module cause that's where the cart/order log templates are defined.
So either we need to merge them and stop using the module-specific constants / event class typehints, or we need to figure out how to conditionally add the service definitions. FUn.
Comment #3
mglamanComment #4
mglamanThis patch should remove the definition if the module is not enabled.
PR https://github.com/drupalcommerce/commerce/pull/591
Comment #6
bojanz CreditAttribution: bojanz at Centarro commentedFixed, thanks Matt.