Interface Yiisoft\Definitions\Contract\ReferenceInterface
| Extends | Yiisoft\Definitions\Contract\DefinitionInterface |
|---|---|
| Implemented by | Yiisoft\Definitions\DynamicReference, Yiisoft\Definitions\Reference |
Reference points to another named definition. Usually it is another service in the container or another object definition in the factory.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| resolve() | Resolve this definition. | Yiisoft\Definitions\Contract\DefinitionInterface |
| to() | Create an instance of the reference pointing to ID specified. | Yiisoft\Definitions\Contract\ReferenceInterface |
Method Details
Defined in: Yiisoft\Definitions\Contract\DefinitionInterface::resolve()
Resolve this definition.
| public abstract mixed|null resolve ( \Psr\Container\ContainerInterface $container ) | ||
| $container | \Psr\Container\ContainerInterface | |
| return | mixed|null |
Ready to use object or null if definition can not be resolved and is marked as optional. |
|---|---|---|
| throws | Yiisoft\Definitions\Exception\InvalidConfigException |
If an object of incorrect type was created. |
| throws | Yiisoft\Definitions\Exception\CircularReferenceException |
If there is a circular reference detected when resolving the definition. |
| throws | \Psr\Container\NotFoundExceptionInterface |
If container does not know how to resolve the definition. |
| throws | Yiisoft\Definitions\Exception\NotInstantiableException |
If an object can not be instantiated. |
public function resolve(ContainerInterface $container): mixed;
Create an instance of the reference pointing to ID specified.
| public abstract static self to ( mixed $id ) | ||
| $id | mixed |
ID of the service or object to point to. |
| throws | Yiisoft\Definitions\Exception\InvalidConfigException |
When definition configuration is not valid. |
|---|---|---|
public static function to(mixed $id): self;
Signup or Login in order to comment.