|
14 | 14 | use Yiisoft\Cache\CacheInterface; |
15 | 15 | use Yiisoft\Db\Connection\ConnectionInterface; |
16 | 16 | use Yiisoft\Db\Sqlite\Connection as SqlLiteConnection; |
| 17 | +use Yiisoft\Definitions\DynamicReference; |
| 18 | +use Yiisoft\Definitions\Reference; |
17 | 19 | use Yiisoft\Di\Container; |
18 | 20 | use Yiisoft\EventDispatcher\Dispatcher\Dispatcher; |
19 | 21 | use Yiisoft\EventDispatcher\Provider\Provider; |
20 | | -use Yiisoft\Definitions\Reference; |
21 | 22 | use Yiisoft\Log\Logger; |
22 | 23 | use Yiisoft\Log\Target\Db\DbTarget; |
23 | 24 | use Yiisoft\Profiler\Profiler; |
@@ -49,26 +50,32 @@ protected function getContainer(): Container |
49 | 50 | if ($this->container === null) { |
50 | 51 | $this->container = new Container([ |
51 | 52 | Aliases::class => [ |
52 | | - '@root' => dirname(__DIR__, 2), |
53 | | - '@runtime' => __DIR__ . '/runtime', |
54 | | - '@yiisoft/yii/db/migration' => '@root', |
| 53 | + 'class' => Aliases::class, |
| 54 | + '__construct()' => [ |
| 55 | + '@root' => dirname(__DIR__, 2), |
| 56 | + '@runtime' => __DIR__ . '/runtime', |
| 57 | + '@yiisoft/yii/db/migration' => '@root', |
| 58 | + ], |
55 | 59 | ], |
56 | 60 |
|
57 | 61 | CacheInterface::class => [ |
58 | 62 | 'class' => Cache::class, |
59 | 63 | '__construct()' => [Reference::to(ArrayCache::class)], |
60 | 64 | ], |
61 | 65 |
|
62 | | - LoggerInterface::class => static fn (ContainerInterface $container) => new Logger([ |
| 66 | + Logger::class => static fn (ContainerInterface $container) => new Logger([ |
63 | 67 | new DbTarget($container->get(ConnectionInterface::class), 'test-table-1'), |
64 | 68 | new DbTarget($container->get(ConnectionInterface::class), 'test-table-2'), |
65 | 69 | ]), |
66 | 70 |
|
| 71 | + LoggerInterface::class => Logger::class, |
| 72 | + |
67 | 73 | ConnectionInterface::class => [ |
68 | 74 | 'class' => SqlLiteConnection::class, |
69 | 75 | '__construct()' => [ |
70 | 76 | 'sqlite:' . self::DB_FILE, |
71 | 77 | ], |
| 78 | + 'setLogger()' => [DynamicReference::to(Logger::class)], |
72 | 79 | ], |
73 | 80 |
|
74 | 81 | MigrationInformerInterface::class => NullMigrationInformer::class, |
|
0 commit comments