You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new system of auto-loading services into the conatiner have some caveats when your bundle contains a lot of "value-object" that must not de declared as services. Those value-object always causes trouble because they require values in the constructor (which is the point of value-objects).
Of course, one can simply setup the exclude option when declaring the service auto-loading:
But it can become very complicated if you need to exclude a lot of objects. One can simply put the value-objects into a dedicated directory. But one may prefer to have the value-objects in the same directory than the service they are related to.
Rather than a auto-opt-in and explicit-opt-out system, we could add an explicit-opt-in system based on annotations (the same way for routing):
This has already been proposed and rejected in the past (we even gave it a try and finally decided to improve supported config formats instead). See #21103 for the discussion.
The new system of auto-loading services into the conatiner have some caveats when your bundle contains a lot of "value-object" that must not de declared as services. Those value-object always causes trouble because they require values in the constructor (which is the point of value-objects).
Of course, one can simply setup the
exclude
option when declaring the service auto-loading:But it can become very complicated if you need to exclude a lot of objects. One can simply put the value-objects into a dedicated directory. But one may prefer to have the value-objects in the same directory than the service they are related to.
Rather than a auto-opt-in and explicit-opt-out system, we could add an explicit-opt-in system based on annotations (the same way for routing):
Then, this configuration will only load classes that have a
@Service
annotation:The best place for it is the FrameworkExtraBundle I guess...
The text was updated successfully, but these errors were encountered: