mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Update concept-di-container.md
This commit is contained in:
@ -336,7 +336,9 @@ You can still override the value set via DI container, though:
|
|||||||
echo \yii\widgets\LinkPager::widget(['maxButtonCount' => 20]);
|
echo \yii\widgets\LinkPager::widget(['maxButtonCount' => 20]);
|
||||||
```
|
```
|
||||||
|
|
||||||
> Tip: no matter which value type it is, it will be overwritten so be careful with option arrays. They won't be merged.
|
> Note: Properties given in the widget call will always override the definition in the DI container.
|
||||||
|
> Even if you specify an array, e.g. `'options' => ['id' => 'mypager']` these will not be merged
|
||||||
|
> with other options but replace them.
|
||||||
|
|
||||||
Another example is to take advantage of the automatic constructor injection of the DI container.
|
Another example is to take advantage of the automatic constructor injection of the DI container.
|
||||||
Assume your controller class depends on some other objects, such as a hotel booking service. You
|
Assume your controller class depends on some other objects, such as a hotel booking service. You
|
||||||
|
Reference in New Issue
Block a user