feat: support union type identifiers for aggregates and sagas#683
Open
dgafka wants to merge 2 commits into
Open
feat: support union type identifiers for aggregates and sagas#683dgafka wants to merge 2 commits into
dgafka wants to merge 2 commits into
Conversation
Characterizes union-typed identifier support (e.g. InternalId|ExternalId) across every identifier-resolution mechanism, and documents the one gap: event sourcing needs JMS's UnionDiscriminator to disambiguate on replay.
…wns them CI runs each package against only its own declared dependencies, so the event-sourcing tests failed there even though they passed locally, where every package shares one vendor tree. packages/Ecotone has no event sourcing dependency and packages/JmsConverter had none either, so both the failing-without-discriminator and working-with-discriminator cases now live in JmsConverter, which declares ecotone/pdo-event-sourcing as a require-dev dependency for exactly this kind of integration test.
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.
Why is this change proposed?
Aggregates and sagas built around multiple identifier sources — e.g. an internally generated ID alongside one supplied by an external system — need a single identifier property that can hold either, without an artificial wrapper type. Ecotone lets
#[Identifier]properties use any PHP type, but native union types (InternalId|ExternalId) had never been verified or documented as supported end-to-end.Description of Changes
aggregate.idmetadata override, and#[TargetIdentifier]mapping.Erroron an uninitialized property unless the union member classes carry their own discriminator field and the event property declares#[UnionDiscriminator].Example
For event-sourced aggregates, add a discriminator field on each union member and point
#[UnionDiscriminator]at it, so JMS can rebuild the right class on replay:Pull Request Contribution Terms