dotkernel / dot-dependency-injection

Dependency Injection (DI) handler
https://docs.dotkernel.org/dot-dependency-injection/
MIT License
0 stars 0 forks source link

Allow other factories to get services to inject #2

Open alexmerlin opened 1 week ago

alexmerlin commented 1 week ago

Dotkernel API needs to create handlers using its own factory and inject dependencies (using setters) instead of getting them through the constructor. This way handler constructors will not to be pulluted by the same key dependencies in each class. Instead, hey can inject only those dependencies that they require for the tasks they need to perform.

Additionally, handlers have other dependencies (services, configs etc) that should be injectable through the constructor, as before.

For this, dot-dependency-injection should expose a solution that allows factories to read the dependencies as an array of ready-to-use instances.

alexmerlin commented 1 week ago

I just found out that I can solve my issue in Dotkerne API without having this feature. Adding this feature to dot-dependency-injection is now optional - if we see value in it, we can keep it. Else, it can be discarded.