Skip to content

Pass argument resolvers and an event dispatcher to the subscription engine - #340

Merged
DavidBadura merged 3 commits into
4.0.xfrom
fix-argument-resolvers-and-taggable-migration
Oct 5, 2026
Merged

DavidBadura merged 3 commits into
4.0.xfrom
fix-argument-resolvers-and-taggable-migration

Conversation

@DavidBadura

@DavidBadura DavidBadura commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Since event-sourcing 4.0 the argument resolvers belong to the DefaultSubscriptionEngine and no longer to the MetadataSubscriberAccessorRepository. We still passed them to the repository, where PHP silently dropped the extra argument, so the LookupResolver and 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 like OnHandleMessageError with #[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_store with type dbal_taggable, which was missing the EventRegistry argument and failed with a TypeError at runtime.

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.
@DavidBadura DavidBadura changed the title Pass argument resolvers to the subscription engine Pass argument resolvers and an event dispatcher to the subscription engine Oct 5, 2026
@DavidBadura DavidBadura added this to the 4.0.0 milestone Oct 5, 2026
@DavidBadura
DavidBadura merged commit 4a0b104 into 4.0.x Oct 5, 2026
23 checks passed
@DavidBadura
DavidBadura deleted the fix-argument-resolvers-and-taggable-migration branch October 5, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants