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
As discussed with @Ocramius today it would make sense for Disco to be able to support autowiring for bean instances to reduce the amount of configuration code needed and to be able to get rid of traits for structuring the configuration code.
At a later stage we could move the methods into separate interfaces - to be able to get rid of the abstract keyword and ultimately get rid of the trait approach.
A few problems need to be solved:
When using interfaces as configuration source, how to cope with method naming clashes?
When there are multiple database instances available how would Disco decide which one to use? We would need a way to pass the method name or alias name to the bean configuration of the ProductService.
For Constructor Injection things are simple, but to be able to decide which methods needs to be called for Setter Injection we might need annotations on the setter methods of the class. So far the goal of Disco was to keep annotations just in the configuration class. Maybe we can solve this differently?
How to cope with primitive values that should be injected? Maybe we could rely on the same naming scheme - e.g. when the parameter of the bean definition method is called $dsn we check if the class has a parameter with that name as constructor argument, same for the setter methods.
For primitives we obviously need to skip the whole injection logic.
When adding this feature it might make sense to enable the production autoloader of Proxy Manager by default as the constant parsing could slow things down quite a bit.
The text was updated successfully, but these errors were encountered:
Just a quick thought: As for primitive value injection we could potentially do some name matching with the parameters injected to the bean configuration method.
run "compiler passes" on the dependency graph (allows replacing dependencies, providing dependencies for when none could be resolved, etc)
select dependencies (we don't need everything)
run further compiler passes to define which ones are consumer-exposed dependencies, and which ones are just private dependencies (services to never be exposed by the container directly)
generate factory code (container-specific, in this case - this is not part of Roave/DependencyResolver)
What you'd do is probably expose a CLI script to generate factory snippets to be copied in the container. What you will get from Roave/DependencyResolver is a framework-agnostic dependency graph that you can traverse and modify.
Instead of sprinkling annotations in the whole code base to configure setter injection, named injection etc. we could simply add those annotations to the bean configuration method.
As discussed with @Ocramius today it would make sense for Disco to be able to support autowiring for bean instances to reduce the amount of configuration code needed and to be able to get rid of traits for structuring the configuration code.
The following configuration:
could then be simplified like this:
At a later stage we could move the methods into separate interfaces - to be able to get rid of the
abstract
keyword and ultimately get rid of the trait approach.A few problems need to be solved:
The text was updated successfully, but these errors were encountered: