di\ServiceLocator get()

get() public method

Returns the component instance with the specified ID.

See also:

public object|null get ( $id, $throwException = true )
$id string

Component ID (e.g. db).

$throwException boolean

Whether to throw an exception if $id is not registered with the locator before.

return object|null

The component of the specified ID. If $throwException is false and $id is not registered before, null will be returned.

throws yii\base\InvalidConfigException

if $id refers to a nonexistent component ID

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

Please login to continue.