Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Id::for(string-class): callable(string): Id shortcut #21

Closed
Baptouuuu opened this issue May 31, 2024 · 0 comments · Fixed by #23
Closed

Add Id::for(string-class): callable(string): Id shortcut #21

Baptouuuu opened this issue May 31, 2024 · 0 comments · Fixed by #23
Assignees
Labels
enhancement New feature or request

Comments

@Baptouuuu
Copy link
Member

When wrapping a string id from outside of the app (user input or external service) to an Id the method Id::of(MyAggregate::class, $id) is used and it's enough.

However when wrapping a Set/Sequence of ids then the call has to be made inside a map resulting in the notation $set->map(static fn(string $id) => Id::of(MyAggregate::class, $id)) which is a bit verbose.

By introducing the method Id::for(string-class): (callable(string): Id) the map can be written as $set->map(Id::of(MyAggregate::class)).

@Baptouuuu Baptouuuu added the enhancement New feature or request label May 31, 2024
@Baptouuuu Baptouuuu self-assigned this May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant