This method is similar to Container::set except that classes registered via this method will only have one
instance. Each time Container::get is called, the same instance of the specified class will be returned.
public setSingleton ( string $class, mixed $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. |