mirror of
https://github.com/friendica/friendica
synced 2025-01-31 20:59:47 +00:00
Move setupLegacyServiceLocator() into App class
This commit is contained in:
parent
2f3ef5359f
commit
f1dba9f89e
2 changed files with 23 additions and 7 deletions
14
src/App.php
14
src/App.php
|
@ -27,6 +27,7 @@ use Friendica\Database\Definition\ViewDefinition;
|
|||
use Friendica\Module\Maintenance;
|
||||
use Friendica\Security\Authentication;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\DiceContainer;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger\Capability\LogChannel;
|
||||
use Friendica\Core\Logger\Handler\ErrorHandler;
|
||||
|
@ -140,7 +141,7 @@ class App
|
|||
|
||||
$this->setupContainerForLogger(LogChannel::APP);
|
||||
|
||||
$this->container->setup();
|
||||
$this->setupLegacyServiceLocator();
|
||||
|
||||
$this->registerErrorHandler();
|
||||
|
||||
|
@ -182,7 +183,7 @@ class App
|
|||
|
||||
$this->setupContainerForLogger($this->determineLogChannel($argv));
|
||||
|
||||
$this->container->setup();
|
||||
$this->setupLegacyServiceLocator();
|
||||
|
||||
$this->registerErrorHandler();
|
||||
|
||||
|
@ -197,7 +198,7 @@ class App
|
|||
|
||||
$this->setupContainerForLogger(LogChannel::AUTH_JABBERED);
|
||||
|
||||
$this->container->setup();
|
||||
$this->setupLegacyServiceLocator();
|
||||
|
||||
$this->registerErrorHandler();
|
||||
|
||||
|
@ -250,6 +251,13 @@ class App
|
|||
]);
|
||||
}
|
||||
|
||||
private function setupLegacyServiceLocator(): void
|
||||
{
|
||||
if ($this->container instanceof DiceContainer) {
|
||||
DI::init($this->container->getDice());
|
||||
}
|
||||
}
|
||||
|
||||
private function registerErrorHandler(): void
|
||||
{
|
||||
ErrorHandler::register($this->container->create(LoggerInterface::class));
|
||||
|
|
|
@ -10,7 +10,6 @@ declare(strict_types=1);
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Wrapper for the Dice class to make some basic setups
|
||||
|
@ -42,7 +41,7 @@ final class DiceContainer implements Container
|
|||
*/
|
||||
public function setup(): void
|
||||
{
|
||||
$this->setupLegacyServiceLocator();
|
||||
// this method can be removed
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,8 +70,17 @@ final class DiceContainer implements Container
|
|||
$this->container = $this->container->addRule($name, $rule);
|
||||
}
|
||||
|
||||
private function setupLegacyServiceLocator(): void
|
||||
/**
|
||||
* Only used to inject Dice into DI class
|
||||
*
|
||||
* @see \Friendica\DI
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function getDice(): Dice
|
||||
{
|
||||
DI::init($this->container);
|
||||
return $this->container;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue