di\Container setSingleton()

setSingleton() public method

Registers a class definition with this container and marks the class as a singleton class.

This method is similar to set() except that classes registered via this method will only have one instance. Each time get() is called, the same instance of the specified class will be returned.

See also set().

public $this setSingleton ( $class, $definition = [], array $params = [] )
$class string

Class name, interface name or alias name

$definition mixed

The definition associated with $class. See set() for more details.

$params array

The list of constructor parameters. The parameters will be passed to the class constructor when get() is called.

return $this

The container itself

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

Please login to continue.