Closed thomasvargiu closed 5 years ago
@thomasvargiu thank you for the proposal.
Do you want to do it so I assigne it to you?
It occurs changes in: config, tests, Readme file and suggestion in composer for lazy dependencies
@elie29 I could work on it. It's a missed feature, a reason why I tried php-di to move then back to zend-servicemanager with zend-di AoT.
I have just a question. I think IMHO that something not related to map zend-servicemanger configuration to php-di should be moved in another configuration key. What do you think?
Well you are totally right. dependencies keys are mapped to zend service manager (except autowires). So we can have defintions key at the same level of dependencies and not inside it.
return [
'definitions' => [
MyClass::class => DI\create(MyClass::class)->lazy(),
],
'dependencies' => [],
];
definitions
is a common key. In the last years projects are using namespace keys as configuration key, so it would be better to use a class namespace to use as a key to avoid conflicts, something like:
return [
Zend\DI\Config::class => [
'definitions' => [],
],
];
But I think we should resolve #28 first, that's why I open it.
Right! should we need for definitions inside the classname key?
Yes, it's better to make all BC break changes in just one release, we don't need to release something today :)
I suggest to resolve #28 and this PR and release them in a single major release.
It would be useful a config key which allows to set custom service definitions.
Something like:
This will allow to use a configuration to define services in different modules when you use a modular structure.