I've added the DI container. I've kept things simple for now to have a readable diff.
config/global.phpconfig file, alongside the existing config files
Piwik\StaticContainer, which returns a singleton of the container: this is deprecated already but necessary so that the container can be used in singletons to migrate to DI
FrontControllernow uses the container to create controllers
That means that we have DI in controllers.
Excellent to see we're getting started on DI!
Regarding the number of dependencies, I had planned to make ocramius/proxy-manager optional in v5.0. I've created an issue for this: https://github.com/mnapoli/PHP-DI/issues/198
I've made the change and created a new
5.0 branch. We will be using that branch in Piwik, that will allow us to make agile changes for v5.0 while not having to rush releasing that new version. I'll keep it as stable and merge features in the branch only when they are considered stable.
For those interested in following v5.0 here is the branch: https://github.com/mnapoli/PHP-DI/pull/200
@mattab this PR can be merged to be released in a beta.
The container is used to create all controllers, i.e.
new $controllerClass() has been replaced by
But nothing is injected anywhere, I've removed the examples using annotations.
That simple change will let us test that everything works correctly for users.
Excellent! now let's see if beta testers notice any problem or error :+1:
@diosmosis the day has come that PHP-DI is included in Piwik! REJOICE!