|
| constructor (mixed ... $parameters) |
| Defines the arguments to use to call the constructor.
|
|
| constructorParameter (string|int $parameter, mixed $value) |
| Defines a value for a specific argument of the constructor.
|
|
| getDefinition (string $entryName) |
|
| lazy () |
| Define the entry as lazy.
|
|
| method (string $method, mixed ... $parameters) |
| Defines a method to call and the arguments to use.
|
|
| methodParameter (string $method, string|int $parameter, mixed $value) |
| Defines a method to call and a value for a specific argument.
|
|
| property (string $property, mixed $value) |
| Defines a value to inject in a property of the object.
|
|
|
const | DEFINITION_CLASS = AutowireDefinition::class |
|
|
array | $constructor = [] |
| Array of constructor parameters.
|
|
array | $methods = [] |
| Array of methods and their parameters.
|
|
◆ constructor()
DI\Definition\Helper\CreateDefinitionHelper::constructor |
( |
mixed ... | $parameters | ) |
|
|
inherited |
Defines the arguments to use to call the constructor.
This method takes a variable number of arguments, example: ->constructor($param1, $param2, $param3)
- Parameters
-
mixed | ...$parameters Parameters to use for calling the constructor of the class. |
- Return values
-
◆ constructorParameter()
DI\Definition\Helper\AutowireDefinitionHelper::constructorParameter |
( |
string|int | $parameter, |
|
|
mixed | $value ) |
Defines a value for a specific argument of the constructor.
This method is usually used together with attributes or autowiring, when a parameter is not (or cannot be) type-hinted. Using this method instead of constructor() allows to avoid defining all the parameters (letting them being resolved using attributes or autowiring) and only define one.
- Parameters
-
string | int | $parameter | Parameter name of position for which the value will be given. |
mixed | $value | Value to give to this parameter. |
- Return values
-
◆ getDefinition()
DI\Definition\Helper\CreateDefinitionHelper::getDefinition |
( |
string | $entryName | ) |
|
|
inherited |
◆ lazy()
DI\Definition\Helper\CreateDefinitionHelper::lazy |
( |
| ) |
|
|
inherited |
Define the entry as lazy.
A lazy entry is created only when it is used, a proxy is injected instead.
- Return values
-
◆ method()
DI\Definition\Helper\CreateDefinitionHelper::method |
( |
string | $method, |
|
|
mixed ... | $parameters ) |
|
inherited |
Defines a method to call and the arguments to use.
This method takes a variable number of arguments after the method name, example:
->method('myMethod', $param1, $param2)
Can be used multiple times to declare multiple calls.
- Parameters
-
string | $method | Name of the method to call. |
| mixed | ...$parameters Parameters to use for calling the method. |
- Return values
-
◆ methodParameter()
DI\Definition\Helper\AutowireDefinitionHelper::methodParameter |
( |
string | $method, |
|
|
string|int | $parameter, |
|
|
mixed | $value ) |
Defines a method to call and a value for a specific argument.
This method is usually used together with attributes or autowiring, when a parameter is not (or cannot be) type-hinted. Using this method instead of method() allows to avoid defining all the parameters (letting them being resolved using attributes or autowiring) and only define one.
If multiple calls to the method have been configured already (e.g. in a previous definition) then this method only overrides the parameter for the first call.
- Parameters
-
string | $method | Name of the method to call. |
string | int | $parameter | Parameter name of position for which the value will be given. |
mixed | $value | Value to give to this parameter. |
- Return values
-
◆ property()
DI\Definition\Helper\CreateDefinitionHelper::property |
( |
string | $property, |
|
|
mixed | $value ) |
|
inherited |
Defines a value to inject in a property of the object.
- Parameters
-
string | $property | Entry in which to inject the value. |
mixed | $value | Value to inject in the property. |
- Return values
-
The documentation for this class was generated from the following file:
- lib/php-di/php-di/src/Definition/Helper/AutowireDefinitionHelper.php