-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Enable auto alias compiler pass by default #34884
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
[DI] Enable auto alias compiler pass by default #34884
Conversation
b38947a
to
4fde517
Compare
Thank you @X-Coder264. |
…er264) This PR was merged into the 5.1-dev branch. Discussion ---------- [DI] Enable auto alias compiler pass by default | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | | Deprecations? | no | Tickets | Fix #34194 | License | MIT | Doc PR | I'm sending this PR to trigger a discussion as @nicolas-grekas suggested in #34194 I'm using this quite a lot in one of my applications and I don't see any reasons why it shouldn't be enabled by default. Commits ------- 4fde517 Enable auto alias compiler pass by default
I just noticed by accident. What is this feature for? Is there some docs? |
That looks very confusing. What is the usecase? |
For example, I work on a highly modular application that is working in different European countries (one instance of the app per country). Almost all features must be switchable (they can be enabled or disabled depending on the requrements - which we solve with Flagception), but a lot of these features also have different requirements for each country - business validation rules, export stuff (what data and in what format must be exported), stuff like fiscalization where each country has its own authority to which you have to register the invoices that you create for your customers when they pay for something on the platform (and each of them has a different API which we must consume) etc. So all of that stuff which needs to be customized differently because it's country specific has an interface and thanks to this auto-alias feature all I have to do is change the parameter which controls the auto-aliasing in Fiscalization example: Domain\Billing\Fiscalization\AuthorityRegistratorInterface:
tags:
- { name: auto_alias, format: '%fiscalization_authority_registrator_class%' } And then in fiscalization_authority_registrator_class: Infrastructure\Billing\Fiscalization\CroatianAuthority\AuthorityRegistrator while for the Slovenian app it is: fiscalization_authority_registrator_class: Infrastructure\Billing\Fiscalization\SlovenianAuthority\AuthorityRegistrator |
Why not separate that via existing *_env.yaml convention? It support also routing and parameters compared services only. |
I'm sending this PR to trigger a discussion as @nicolas-grekas suggested in #34194
I'm using this quite a lot in one of my applications and I don't see any reasons why it shouldn't be enabled by default.