Problem/Motivation

Commerce email is not sending any email. It fails in subscribe to commerce events because the service "plugin.manager.commerce_email_event" is not yet available during getSubscribedEvents() execution.

Steps to reproduce

I think is some arbitrary, because it depends on service discovery order.

Im using Drupal 9.2.4 with this issue fork of commerce email: Automated Drupal 9 compatibility fixes (3147252)

Proposed resolution

Refactor getSubscribedEvents() method in src/EventSubscriber/EmailSubscriber.php to prevent it from being dependent on execution at runtime (as it is recomended in EventSubscriberInterface method documentation)

Remaining tasks

User interface changes

API changes

Data model changes

Comments

ecdani created an issue. See original summary.

ecdani’s picture

Title: Failing in subscribe to email events » Failed to subscribe to mail events
ecdani’s picture

Status: Active » Needs review
StatusFileSize
new3.7 KB

I've changed the subscription mechanism to make it more deterministic.
Now it relies on the "onRequest" kernel event (that it executes before any commerce event) to do the rest of event subscriptions.

rszrama’s picture

Version: 8.x-1.0-beta1 » 8.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

Ah! I noticed this, too, but couldn't figure it out ... just realized that flushing caches in the UI made it work where rebuilding the cache via drush didn't. Your solution appears to have done the trick.

  • rszrama committed cf7aff7 on 8.x-1.x authored by ecdani
    Issue #3240114 by ecdani, rszrama: Subscribe this module to mail events...
rszrama’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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

jsacksick’s picture

This introduced a break with Drupal 8. The module still claims D8 compatibility, but Symfony\Contracts\EventDispatcher\EventDispatcherInterface was introduced in D9.1 (See https://www.drupal.org/node/3159012).