Pass argument resolvers and an event dispatcher to the subscription engine - #340
Merged
Merged
Conversation
Since event-sourcing 4.0 the argument resolvers are passed to the DefaultSubscriptionEngine instead of the MetadataSubscriberAccessorRepository. The bundle still passed them to the repository, where they were silently ignored, so the LookupResolver and custom resolvers were never used. Also add the missing EventRegistry argument when migrating to a TaggableDoctrineDbalStore.
The engine dispatches events like OnHandleMessageError on its own dispatcher and registers internal listeners on it, so we provide a separate service instead of the global event dispatcher. Users can hook in via AsEventListener with the dispatcher option. This also lets us pass the argument resolvers positionally.
DanielBadura
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since event-sourcing 4.0 the argument resolvers belong to the
DefaultSubscriptionEngineand no longer to theMetadataSubscriberAccessorRepository. We still passed them to the repository, where PHP silently dropped the extra argument, so theLookupResolverand any custom resolvers were never used. The existing test only checked the old argument position, so it didn't catch this.The engine now also gets its own event dispatcher
event_sourcing.subscription.event_dispatcher, so you can hook into engine events likeOnHandleMessageErrorwith#[AsEventListener(dispatcher: 'event_sourcing.subscription.event_dispatcher')]. It's a separate service on purpose, because the engine registers its own internal listeners on it and they shouldn't end up on the global dispatcher.While at it I also fixed
migrate_to_new_storewith typedbal_taggable, which was missing theEventRegistryargument and failed with a TypeError at runtime.