di\NotInstantiableException __construct()

__construct() public method public void __construct ( $class, $message = null, $code = 0, Exception $previous = null )$class $message $code $previous

di\NotInstantiableException getName()

getName() public method public string getName ( )return string The user-friendly name of this exception

di\Instance __construct()

__construct() protected method Constructor. protected void __construct ( $id )$id string The component ID

di\Instance of()

of() public static method Creates a new Instance object. public static yii\di\Instance of ( $id )$id string The component ID return yii\di\Instance The new Instance object.

di\Instance get()

get() public method Returns the actual object referenced by this Instance object. public object get ( $container = null )$container yii\di\ServiceLocator|yii\di\Container The container used to locate the referenced object. If null, the method will first try Yii::$app then Yii::$container. return object The actual object referenced by this Instance object.

di\Instance ensure()

ensure() public static method Resolves the specified reference into the actual object and makes sure it is of the specified type. The reference may be specified as a string or an Instance object. If the former, it will be treated as a component ID, a class/interface name or an alias, depending on the container type. If you do not specify a container, the method will first try Yii::$app followed by Yii::$container. For example, use yii\db\Connection; // returns Yii::$app->db $db = Instan

di\Instance $id

$id public property The component ID, class name, interface name or alias name public string $id = null

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 definitio

di\Container set()

set() public method Registers a class definition with this container. For example, // register a class name as is. This can be skipped. $container->set('yii\db\Connection'); // register an interface // When a class depends on the interface, the corresponding class // will be instantiated as the dependent object $container->set('yii\mail\MailInterface', 'yii\swiftmailer\Mailer'); // register an alias name. You can use $container->get('foo') // to create an instance of Connection $

di\Container resolveDependencies()

resolveDependencies() protected method Resolves dependencies by replacing them with the actual object instances. protected array resolveDependencies ( $dependencies, $reflection = null )$dependencies array The dependencies $reflection ReflectionClass The class reflection associated with the dependencies return array The resolved dependencies throws yii\base\InvalidConfigException if a dependency cannot be resolved or if a dependency cannot be fulfilled.