Use ObjectFactory to create API modules
authormainframe98 <k.s.werf@hotmail.com>
Fri, 6 Sep 2019 11:38:55 +0000 (13:38 +0200)
committerMainframe98 <k.s.werf@hotmail.com>
Mon, 9 Sep 2019 18:50:16 +0000 (18:50 +0000)
commiteb8823743c281fe72446ae06809467fd2746f7f7
treef797f5ee353c956f46bfb8af97f187309e381272
parent74524d25035802dd0350ace6212d7ebe484af993
Use ObjectFactory to create API modules

This will allow constructing API modules that need services.

This overhauls some of the internals of the ApiModuleManager,
but the public interface remains unchanged.
The $class parameter of addModule, (now called $spec)
also allows passing an array with the spec of the module.
Note that this spec requires the attribute 'class' to be present,
even when 'factory' is specified. This is the same as before,
where $class was always required.

In a perfect DI world ObjectFactory would be injected into
ApiMain::__construct and ApiMain would pass that to its instance
of ApiModuleManager, but that is currently not possible, so for now
it is injected in ApiModuleManager by having ApiMain::__construct
call the service locator.

Bug: T222388
Change-Id: Iee04afc27283547dd68d6db93f44ac2e0ebf1258
RELEASE-NOTES-1.34
includes/api/ApiMain.php
includes/api/ApiModuleManager.php
includes/api/ApiQuery.php
tests/phpunit/includes/api/ApiModuleManagerTest.php
tests/phpunit/includes/api/ApiQueryLanguageinfoTest.php
tests/phpunit/includes/api/format/ApiFormatTestBase.php