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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skyredwang created an issue. See original summary.

bojanz’s picture

Title: commerce_log has dependency on cart? » commerce_log crashes if commerce_cart is not enabled

Looks 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.

mglaman’s picture

Assigned: Unassigned » mglaman
mglaman’s picture

Status: Active » Needs review
FileSize
1.1 KB

This patch should remove the definition if the module is not enabled.

PR https://github.com/drupalcommerce/commerce/pull/591

  • bojanz committed 3d022af on 8.x-2.x authored by mglaman
    Issue #2839426 by mglaman: commerce_log crashes if commerce_cart is is...
bojanz’s picture

Status: Needs review » Fixed

Fixed, thanks Matt.

Status: Fixed » Closed (fixed)

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