Final Class Yiisoft\Definitions\DynamicReference
| Inheritance | Yiisoft\Definitions\DynamicReference |
|---|---|
| Implements | Yiisoft\Definitions\Contract\ReferenceInterface |
The DynamicReference defines a dependency to a service not defined in the container.
Definition may be defined multiple ways ({@see \Yiisoft\Definitions\Helpers\Normalizer}). For example:
[
MyService::class => [
'__construct()' => [
DynamicReference::to([
'class' => SomeClass::class,
'$someProp' => 15
])
]
]
]
Public Methods
| Method | Description | Defined By |
|---|---|---|
| resolve() | Yiisoft\Definitions\DynamicReference | |
| to() | Yiisoft\Definitions\DynamicReference |
Method Details
| public mixed resolve ( \Psr\Container\ContainerInterface $container ) | ||
| $container | \Psr\Container\ContainerInterface | |
public function resolve(ContainerInterface $container): mixed
{
return $this->definition->resolve($container);
}
See also Yiisoft\Definitions\Helpers\Normalizer.
| public static self to ( mixed $id ) | ||
| $id | mixed | |
| throws | Yiisoft\Definitions\Exception\InvalidConfigException |
If definition is not valid. |
|---|---|---|
public static function to(mixed $id): self
{
return new self($id);
}
Signup or Login in order to comment.