[10.x] Add ability to customize class resolution in event discovery #48031
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.
I recently re-read a tweet by Dries saying "Most objects can be placed wherever you like in the app directory." https://twitter.com/driesvints/status/1526835414098534400?s=20
I develop my projects using the DDD structure defined by Brent in his blog. The main point here is the way namespaces are defined (https://stitcher.io/blog/laravel-beyond-crud-01-domain-oriented-laravel#on-the-topic-of-namespaces) :
Everything goes well but event discovery does not work because file name to class name translation is not designed for this structure.
This PR adds the ability to customize the way the translation is done and unlocks event discovery in such DDD structures.