Hello.
This example is under discussion.
I am not able to comprehend the meaning of this example.
So there are the questions:
-
what is the main target of this example? To populate ‘cache’ component with correct ‘db’ connection instance?
-
There is the third parameter Instance::of(‘db’) in this call:
$container->set('cache', 'yii\caching\DbCache', Instance::of('db'));
But yii\di\Container::set expects the third parameter to be an array
- We are saving the predefined configuration in this container :
$container = new \yii\di\Container;
But latter we do not seem to use this container at all and instead we are using \yii::$app and \yii::$container