Skip to content

Commit

Permalink
Adapt to DI changes (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Nov 26, 2021
1 parent 8beea20 commit d18ffa8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/ConsoleApplicationRunner.php
Expand Up @@ -10,6 +10,7 @@
use Throwable;
use Yiisoft\Config\Config;
use Yiisoft\Di\Container;
use Yiisoft\Di\ContainerConfig;
use Yiisoft\Definitions\Exception\CircularReferenceException;
use Yiisoft\Definitions\Exception\InvalidConfigException;
use Yiisoft\Definitions\Exception\NotFoundException;
Expand Down Expand Up @@ -109,13 +110,16 @@ public function run(): void
{
$config = $this->config ?? ConfigFactory::create($this->rootPath, $this->environment);

$container = $this->container ?? new Container(
$config->get('console'),
$config->get('providers-console'),
[],
$this->debug,
$config->get('delegates-console')
);
$container = $this->container;
if ($container === null) {
$containerConfig = ContainerConfig::create()
->withDefinitions($config->get('console'))
->withProviders($config->get('providers-console'))
->withValidate($this->debug)
->withDelegates($config->get('delegates-console'));

$container = new Container($containerConfig);
}

if ($container instanceof Container) {
$container = $container->get(ContainerInterface::class);
Expand Down

0 comments on commit d18ffa8

Please sign in to comment.