Splitted module manager setup and module loading in bootstrap code
Allows different implementations (Web, Cli...) to behave differently without duplicating code
This commit is contained in:
parent
e037716585
commit
bb1c560e22
|
@ -337,14 +337,23 @@ abstract class ApplicationBootstrap
|
|||
}
|
||||
|
||||
/**
|
||||
* Setup module loader and all enabled modules
|
||||
* Setup module manager
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
protected function setupModules()
|
||||
protected function setupModuleManager()
|
||||
{
|
||||
$this->moduleManager = new ModuleManager($this, $this->configDir . '/enabledModules');
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all enabled modules
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
protected function loadEnabledModules()
|
||||
{
|
||||
try {
|
||||
$this->moduleManager->loadEnabledModules();
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -67,7 +67,7 @@ class Cli extends ApplicationBootstrap
|
|||
->fixLoggingConfig()
|
||||
->setupErrorHandling()
|
||||
->setupResourceFactory()
|
||||
->setupModules()
|
||||
->setupModuleManager()
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -93,34 +93,6 @@ class Cli extends ApplicationBootstrap
|
|||
return $this->cliLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup module loader
|
||||
*
|
||||
* TODO: This can be removed once broken bootstrapping has been fixed
|
||||
* Loading the module manager and enabling all modules have former
|
||||
* been two different tasks. CLI does NOT enable any module by default.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
protected function setupModules()
|
||||
{
|
||||
$this->moduleManager = new ModuleManager($this, $this->getConfigDir('enabledModules'));
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for module manager
|
||||
*
|
||||
* TODO: This can also be removed once fixed. Making everything private
|
||||
* made this duplication necessary
|
||||
*
|
||||
* @return ModuleManager
|
||||
*/
|
||||
public function getModuleManager()
|
||||
{
|
||||
return $this->moduleManager;
|
||||
}
|
||||
|
||||
protected function parseBasicParams()
|
||||
{
|
||||
$this->params = Params::parse();
|
||||
|
|
|
@ -110,7 +110,8 @@ class Web extends ApplicationBootstrap
|
|||
->setupRequest()
|
||||
->setupZendMvc()
|
||||
->setupTranslation()
|
||||
->setupModules()
|
||||
->setupModuleManager()
|
||||
->loadEnabledModules()
|
||||
->setupRoute()
|
||||
->setupPagination();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue