Inject Activator and SettingsController into Initializer

[MAILPOET-1823]
This commit is contained in:
Rostislav Wolny
2019-02-20 16:09:59 +01:00
committed by M. Shull
parent d5ea906433
commit 4a6fb923e0

View File

@@ -34,18 +34,28 @@ class Initializer {
/** @var ContainerInterface */ /** @var ContainerInterface */
private $container; private $container;
/** @var Activator */
private $activator;
/** @var SettingsController */
private $settings;
const INITIALIZED = 'MAILPOET_INITIALIZED'; const INITIALIZED = 'MAILPOET_INITIALIZED';
function __construct( function __construct(
ContainerWrapper $container, ContainerWrapper $container,
RendererFactory $renderer_factory, RendererFactory $renderer_factory,
AccessControl $access_control, AccessControl $access_control,
API $api API $api,
Activator $activator,
SettingsController $settings
) { ) {
$this->container = $container; $this->container = $container;
$this->renderer_factory = $renderer_factory; $this->renderer_factory = $renderer_factory;
$this->access_control = $access_control; $this->access_control = $access_control;
$this->api = $api; $this->api = $api;
$this->activator = $activator;
$this->settings = $settings;
} }
function init() { function init() {
@@ -116,8 +126,7 @@ class Initializer {
} }
function runActivator() { function runActivator() {
$activator = $this->container->get(Activator::class); return $this->activator->activate();
return $activator->activate();
} }
function setupDB() { function setupDB() {
@@ -170,7 +179,7 @@ class Initializer {
function maybeDbUpdate() { function maybeDbUpdate() {
try { try {
$current_db_version = $this->container->get(SettingsController::class)->get('db_version'); $current_db_version = $this->settings->get('db_version');
} catch (\Exception $e) { } catch (\Exception $e) {
$current_db_version = null; $current_db_version = null;
} }