Key ChannelBundle event subscribers on the event class (Mautic 8.0) - #644
Key ChannelBundle event subscribers on the event class (Mautic 8.0)#644promptless-for-oss wants to merge 1 commit into
Conversation
Update the plugin Channels extension examples for the Mautic 8.0 class-name event dispatch introduced in mautic/mautic#17201: key subscribers on ChannelEvent::class and ChannelBroadcastEvent::class instead of the ChannelEvents string constants, drop the now-unused import, and correct the broadcast listener reference to the event class. Add a note explaining that subscribers keyed on the old ChannelEvents constants silently stop receiving these events.
| { | ||
| return [ | ||
| ChannelEvents::ADD_CHANNEL => ['onAddChannel', 100], | ||
| ChannelEvent::class => ['onAddChannel', 100], |
There was a problem hiding this comment.
ADD_CHANNEL subscriber example now keys on ChannelEvent::class. Confirmed: Mautic\ChannelBundle\Event\ChannelEvent is the event class, and mautic/mautic PR #17201's UPGRADE-8.0.md maps ChannelEvents::ADD_CHANNEL -> ChannelEvent.
| { | ||
| return [ | ||
| ChannelEvents::CHANNEL_BROADCAST => ['onChannelBroadcast', 0] | ||
| ChannelBroadcastEvent::class => ['onChannelBroadcast', 0], |
There was a problem hiding this comment.
Broadcast subscriber example now keys on ChannelBroadcastEvent::class. Confirmed: Mautic\ChannelBundle\Event\ChannelBroadcastEvent is the event class, and mautic/mautic PR #17201's UPGRADE-8.0.md maps ChannelEvents::CHANNEL_BROADCAST -> ChannelBroadcastEvent.
|
|
||
| .. note:: | ||
|
|
||
| From Mautic 8.0, Mautic dispatches and subscribes to these ChannelBundle events by their event class name (for example ``ChannelEvent::class``) rather than the ``ChannelEvents`` constant. A subscriber still keyed on the old ``ChannelEvents`` constant silently stops receiving the event, so re-key it on the event class. The ``ChannelEvents`` constants stay defined for backward compatibility but no longer route dispatch for these events. |
There was a problem hiding this comment.
New note text: from Mautic 8.0, ChannelBundle events (ADD_CHANNEL, CHANNEL_BROADCAST, MESSAGE_QUEUED, PROCESS_MESSAGE_QUEUE, PROCESS_MESSAGE_QUEUE_BATCH) dispatch by event class name instead of the ChannelEvents string constants, so a subscriber keyed on the old constant stops receiving the event. Verified against UPGRADE-8.0.md (added in mautic/mautic PR #17201), which states the change and gives the full 5-row constant-to-class mapping table.
|
|
||
| .. note:: | ||
|
|
||
| From Mautic 8.0, Mautic dispatches and subscribes to these ChannelBundle events by their event class name (for example ``ChannelEvent::class``) rather than the ``ChannelEvents`` constant. A subscriber still keyed on the old ``ChannelEvents`` constant silently stops receiving the event, so re-key it on the event class. The ``ChannelEvents`` constants stay defined for backward compatibility but no longer route dispatch for these events. |
There was a problem hiding this comment.
Confirms Mautic\ChannelBundle\ChannelEvents constants class still exists, unmodified by PR #17201's diff, i.e. the constants are retained for backward compatibility even though they no longer route dispatch of the five converted events.
Open in Promptless
Mautic 8.0 dispatches five ChannelBundle events by their event class name (Symfony 4.3+ style) instead of the
ChannelEvents::*string constants, so a plugin subscriber still keyed on one of those constants silently stops receiving the event. This updates the plugin Channels extension page to reflect the new convention: the two subscriber examples now key onChannelEvent::classandChannelBroadcastEvent::class(priorities preserved), the now-unusedChannelEventsimport is dropped, and the broadcast listener reference is corrected to\Mautic\ChannelBundle\Event\ChannelBroadcastEvent. A new note explains the change and tells developers to re-key affected subscribers on the event class; theChannelEventsconstants remain defined for backward compatibility. Reflects mautic/mautic#17201 (targets 8.x, documented on the 7.2 docs branch).Trigger Events