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

[10.x] Add ability to customize class resolution in event discovery #48031

Conversation

bastien-phi
Copy link
Contributor

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) :

{
    // …

    "autoload" : {
        "psr-4" : {
            "App\\" : "app/App/",
            "Domain\\" : "app/Domain/",
            "Support\\" : "app/Support/"
        }
    }
}

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.

@taylorotwell taylorotwell merged commit 1eed738 into laravel:10.x Aug 11, 2023
@bastien-phi bastien-phi deleted the add_ability_to_customize_file_to_class_resolution_in_discover_events branch August 16, 2023 07:02
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