di\ServiceLocator setComponents()

setComponents() public method

Registers a set of component definitions in this locator.

This is the bulk version of set(). The parameter should be an array whose keys are component IDs and values the corresponding component definitions.

For more details on how to specify component IDs and definitions, please refer to set().

If a component definition with the same ID already exists, it will be overwritten.

The following is an example for registering two component definitions:

[
    'db' => [
        'class' => 'yii\db\Connection',
        'dsn' => 'sqlite:path/to/file.db',
    ],
    'cache' => [
        'class' => 'yii\caching\DbCache',
        'db' => 'db',
    ],
]
public void setComponents ( $components )
$components array

Component definitions or instances

doc_Yii
2016-10-30 17:01:10
Comments
Leave a Comment

Please login to continue.