Problem/Motivation

#3612558 added file attachments to notifications, but only a dispatcher constructing the OrchestraNotificationEvent could supply them. A module often needs to attach a file to a notification it did not dispatch: the Yoyaku ticket submodule attaches a PDF to the confirmation the order notifier sends. With attachments fixed at construction there is no seam for that short of changing every dispatcher.

Proposed resolution

Make attachments enrichable on the event, the standard Symfony pattern: any subscriber may add one, and the delivery channels read them last.

  1. OrchestraNotificationEvent keeps the constructor seed, but stores attachments mutably and gains addAttachment() and getAttachments(), plus a DELIVERY_PRIORITY constant.
  2. Both mail channels (orchestra_mail, orchestra_easy_email) subscribe at DELIVERY_PRIORITY and read getAttachments(), so every enricher has contributed before a channel sends.

This needs no dispatcher-side seam: a module attaches to any notification by subscribing at the default priority and calling addAttachment(). It keeps the layering intact, the neutral contract has no transport serializer and each channel still owns its own mapping.

Remaining tasks

  • Event API change and channel priority.
  • Test that a subscriber-added attachment is delivered.

API changes

  • OrchestraNotificationEvent: attachments is no longer a public readonly property; use addAttachment() and getAttachments(). The constructor still accepts an initial array. New DELIVERY_PRIORITY constant.

Follow-up to #3612558.

Issue fork orchestra-3612575

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

  • mably committed b1afc3df on 1.x
    feat: #3612575 Make notification attachments enrichable: addAttachment...
mably’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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