Skip to content

Key plugin install/update event subscribers on the event class (Mautic 8) - #634

Open
promptless-for-oss wants to merge 8 commits into
mautic:8.0from
Promptless:promptless/pr-17162-plugin-events-by-class
Open

Key plugin install/update event subscribers on the event class (Mautic 8)#634
promptless-for-oss wants to merge 8 commits into
mautic:8.0from
Promptless:promptless/pr-17162-plugin-events-by-class

Conversation

@promptless-for-oss

@promptless-for-oss promptless-for-oss commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Open in Promptless

Since Mautic 8, PluginBundle dispatches its events using the Symfony 4.3 style, where the event object's class name is the event name. The plugin install and update subscriber example in docs/plugins/installation.rst now keys getSubscribedEvents() on PluginInstallEvent::class and PluginUpdateEvent::class instead of the PluginEvents::ON_PLUGIN_INSTALL and PluginEvents::ON_PLUGIN_UPDATE string constants, and drops the now-unused PluginEvents import. A version-aware note explains that Mautic dispatches these events by the event object alone (Symfony 4.3 style).


Review feedback applied (maintainer @escopecz on this PR):

  • "No need to say this. The constants will be removed too and they do nothing when used." — applied: removed the claim that the PluginEvents constants remain defined but unused.
  • "No need to mention the silent failure. The constants will be removed." — applied: removed the silent-failure explanation entirely.
  • "Drop 'Only PluginBundle event dispatch changed in Mautic 8. Event families that still dispatch by a string constant should keep keying subscribers on that constant.' As all the events are updated the same way." — applied verbatim: removed both sentences from the version-aware note, leaving only "Mautic dispatches these events by the event object alone, so the event's class name serves as the event name. This matches the Symfony 4.3 dispatch style."

Trigger Events

Comment thread docs/plugins/installation.rst
Comment thread docs/plugins/installation.rst
Comment thread docs/plugins/installation.rst Outdated
Comment thread docs/plugins/installation.rst Outdated
Comment thread docs/plugins/installation.rst
Comment thread docs/plugins/installation.rst Outdated
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

I noticed that some CI checks failed for this PR. I'm investigating whether the failures are caused by this suggestion. If they're unrelated or pre-existing, I'll leave this suggestion unchanged and create a separate suggestion if a standalone docs fix is needed.

@promptless-for-oss
promptless-for-oss marked this pull request as ready for review September 2, 2026 18:04
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Thanks @escopecz — noted. Since the PluginEvents constants are being removed too and do nothing when used, I'll revise this PR so it no longer describes them as still-defined-but-unused, and push an update here shortly.

@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Update: confirmed against #17162 — I'm dropping both the "constants remain defined but unused" and the "silent failure" points from the note, keeping the Symfony 4.3 explanation and the guidance for event families that still dispatch by string constant. Revising the PR now.

Drop the 'PluginEvents constants remain defined but unused' and
'silent failure' framing per maintainer @escopecz's review on PR mautic#634;
the constants are being removed and do nothing when used. Scope the
class-name dispatch change to PluginBundle.
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

@escopecz both comments are addressed. The note in docs/plugins/installation.rst no longer says the PluginEvents constants remain defined-but-unused and no longer mentions silent listener failure. It now explains only that Mautic 8 dispatches these events by the event object (Symfony 4.3 style), scopes that to PluginBundle, and keeps the guidance that event families still dispatching by a string constant should keep keying on that constant. Pushed to this PR; Vale passes on the edited file.

@adiati98
adiati98 requested a review from escopecz September 4, 2026 08:34
Comment thread docs/plugins/installation.rst Outdated
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Thanks @escopecz — got it. I'll drop that sentence about PluginBundle being the only event dispatch that changed, since all the events are being updated the same way, and update this PR shortly.

Per maintainer @escopecz review on PR mautic#634: all Mautic events are
being migrated to Symfony 4.3 dispatch-by-class the same way, so the
PluginBundle-only scoping caveat is inaccurate. Removes the two
sentences from the version-aware note in docs/plugins/installation.rst.
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Done @escopecz — the version-aware note in docs/plugins/installation.rst no longer includes the "Only PluginBundle event dispatch changed in Mautic 8…" scoping sentences. Since all Mautic events are being migrated to the Symfony 4.3 dispatch-by-class style the same way, the note now simply states that Mautic dispatches these events by the event object alone. The change is live on this PR branch.

@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

I noticed that some CI checks failed for this PR. I'm investigating whether the failures are caused by this suggestion. If they're unrelated or pre-existing, I'll leave this suggestion unchanged and create a separate suggestion if a standalone docs fix is needed.

escopecz
escopecz previously approved these changes Sep 4, 2026

@escopecz escopecz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good 👍

@promptless-for-oss
promptless-for-oss changed the base branch from 7.2 to 8.0 September 9, 2026 16:12
@promptless-for-oss
promptless-for-oss dismissed escopecz’s stale review September 9, 2026 16:12

The base branch was changed.

Replace this page's copy of the general Mautic 8 class-name event
dispatch explanation with a cross-reference to the shared
"Mautic 8: class-name event dispatch" section in plugins/event_listeners.rst,
keeping the bundle-specific facts. Part of consolidating the duplicated
note across the open Mautic 8 dev-docs PRs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants