class Definition
Definition represents a service definition.
| protected | $arguments | ||
| $innerServiceId |
| __construct(string|null $class = null, array $arguments = array()) | ||
| array | getChanges() Returns all changes tracked for the Definition object. | |
| $this | setChanges(array $changes) Sets the tracked changes for the Definition object. | |
| $this | setFactory(string|array $factory) Sets a factory. | |
| string|array|null | getFactory() Gets the factory. | |
| $this | setDecoratedService(string|null $id, string|null $renamedId = null, int $priority = 0) Sets the service that this service is decorating. | |
| array|null | getDecoratedService() Gets the service that this service is decorating. | |
| $this | setClass(string $class) Sets the service class. | |
| string|null | getClass() Gets the service class. | |
| $this | setArguments(array $arguments) Sets the arguments to pass to the service constructor/factory method. | |
| $this | setProperties(array $properties) Sets the properties to define when creating the service. | |
| array | getProperties() Gets the properties to define when creating the service. | |
| $this | setProperty(string $name, mixed $value) Sets a specific property. | |
| $this | addArgument(mixed $argument) Adds an argument to pass to the service constructor/factory method. | |
| $this | replaceArgument(int|string $index, mixed $argument) Replaces a specific argument. | |
| $this | setArgument(int|string $key, mixed $value) Sets a specific argument. | |
| array | getArguments() Gets the arguments to pass to the service constructor/factory method. | |
| mixed | getArgument(int|string $index) Gets an argument to pass to the service constructor/factory method. | |
| $this | setMethodCalls(array $calls = array()) Sets the methods to call after service initialization. | |
| $this | addMethodCall(string $method, array $arguments = array()) Adds a method to call after service initialization. | |
| $this | removeMethodCall(string $method) Removes a method to call after service initialization. | |
| bool | hasMethodCall(string $method) Check if the current definition has a given method to call after service initialization. | |
| array | getMethodCalls() Gets the methods to call after service initialization. | |
| $this | setInstanceofConditionals(array $instanceof) Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class. | |
| ChildDefinition[] | getInstanceofConditionals() Gets the definition templates to conditionally apply on the current definition, keyed by parent interface/class. | |
| $this | setAutoconfigured(bool $autoconfigured) Sets whether or not instanceof conditionals should be prepended with a global set. | |
| bool | isAutoconfigured() | |
| $this | setTags(array $tags) Sets tags for this definition. | |
| array | getTags() Returns all tags. | |
| array | getTag(string $name) Gets a tag by name. | |
| $this | addTag(string $name, array $attributes = array()) Adds a tag for this definition. | |
| bool | hasTag(string $name) Whether this definition has a tag with the given name. | |
| $this | clearTag(string $name) Clears all tags for a given name. | |
| $this | clearTags() Clears the tags for this definition. | |
| $this | setFile(string $file) Sets a file to require before creating the service. | |
| string|null | getFile() Gets the file to require before creating the service. | |
| $this | setShared(bool $shared) Sets if the service must be shared or not. | |
| bool | isShared() Whether this service is shared. | |
| $this | setPublic(bool $boolean) Sets the visibility of this service. | |
| bool | isPublic() Whether this service is public facing. | |
| $this | setPrivate(bool $boolean) Sets if this service is private. | |
| bool | isPrivate() Whether this service is private. | |
| $this | setLazy(bool $lazy) Sets the lazy flag of this service. | |
| bool | isLazy() Whether this service is lazy. | |
| $this | setSynthetic(bool $boolean) Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected. | |
| bool | isSynthetic() Whether this definition is synthetic, that is not constructed by the container, but dynamically injected. | |
| $this | setAbstract(bool $boolean) Whether this definition is abstract, that means it merely serves as a template for other definitions. | |
| bool | isAbstract() Whether this definition is abstract, that means it merely serves as a template for other definitions. | |
| $this | setDeprecated(bool $status = true, string $template = null) Whether this definition is deprecated, that means it should not be called anymore. | |
| bool | isDeprecated() Whether this definition is deprecated, that means it should not be called anymore. | |
| string | getDeprecationMessage(string $id) Message to use if this definition is deprecated. | |
| $this | setConfigurator(string|array $configurator) Sets a configurator to call after the service is fully initialized. | |
| callable|null | getConfigurator() Gets the configurator to call after the service is fully initialized. | |
| bool | isAutowired() Is the definition autowired? | |
| $this | setAutowired(bool $autowired) Enables/disables autowiring. | |
| array|BoundArgument[] | getBindings() Gets bindings. | |
| $this | setBindings(array $bindings) Sets bindings. | |
| $this | addError(string $error) Add an error that occurred when building this Definition. | |
| array | getErrors() Returns any errors that occurred while building this Definition. |
| string|null | $class | The service class |
| array | $arguments | An array of arguments to pass to the service constructor |
Returns all changes tracked for the Definition object.
| array | An array of changes for this Definition |
Sets the tracked changes for the Definition object.
| array | $changes | An array of changes for this Definition |
| $this |
Sets a factory.
| string|array | $factory | A PHP function or an array containing a class/Reference and a method to call |
| $this |
Gets the factory.
| string|array|null | The PHP function or an array containing a class/Reference and a method to call |
Sets the service that this service is decorating.
| string|null | $id | The decorated service id, use null to remove decoration |
| string|null | $renamedId | The new decorated service id |
| int | $priority | The priority of decoration |
| $this |
| InvalidArgumentException | in case the decorated service id and the new decorated service id are equals |
Gets the service that this service is decorating.
| array|null | An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated |
Sets the service class.
| string | $class | The service class |
| $this |
Gets the service class.
| string|null | The service class |
Sets the arguments to pass to the service constructor/factory method.
| array | $arguments |
| $this |
Sets the properties to define when creating the service.
| array | $properties |
| $this |
Gets the properties to define when creating the service.
| array |
Sets a specific property.
| string | $name | |
| mixed | $value |
| $this |
Adds an argument to pass to the service constructor/factory method.
| mixed | $argument | An argument |
| $this |
Replaces a specific argument.
| int|string | $index | |
| mixed | $argument |
| $this |
| OutOfBoundsException | When the replaced argument does not exist |
Sets a specific argument.
| int|string | $key | |
| mixed | $value |
| $this |
Gets the arguments to pass to the service constructor/factory method.
| array | The array of arguments |
Gets an argument to pass to the service constructor/factory method.
| int|string | $index |
| mixed | The argument value |
| OutOfBoundsException | When the argument does not exist |
Sets the methods to call after service initialization.
| array | $calls |
| $this |
Adds a method to call after service initialization.
| string | $method | The method name to call |
| array | $arguments | An array of arguments to pass to the method call |
| $this |
| InvalidArgumentException | on empty $method param |
Removes a method to call after service initialization.
| string | $method | The method name to remove |
| $this |
Check if the current definition has a given method to call after service initialization.
| string | $method | The method name to search for |
| bool |
Gets the methods to call after service initialization.
| array | An array of method calls |
Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
| array | $instanceof | ChildDefinition[] |
| $this |
Gets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
| ChildDefinition[] |
Sets whether or not instanceof conditionals should be prepended with a global set.
| bool | $autoconfigured |
| $this |
| bool |
Sets tags for this definition.
| array | $tags |
| $this |
Returns all tags.
| array | An array of tags |
Gets a tag by name.
| string | $name | The tag name |
| array | An array of attributes |
Adds a tag for this definition.
| string | $name | The tag name |
| array | $attributes | An array of attributes |
| $this |
Whether this definition has a tag with the given name.
| string | $name |
| bool |
Clears all tags for a given name.
| string | $name | The tag name |
| $this |
Clears the tags for this definition.
| $this |
Sets a file to require before creating the service.
| string | $file | A full pathname to include |
| $this |
Gets the file to require before creating the service.
| string|null | The full pathname to include |
Sets if the service must be shared or not.
| bool | $shared | Whether the service must be shared or not |
| $this |
Whether this service is shared.
| bool |
Sets the visibility of this service.
| bool | $boolean |
| $this |
Whether this service is public facing.
| bool |
Sets if this service is private.
When set, the "private" state has a higher precedence than "public". In version 3.4, a "private" service always remains publicly accessible, but triggers a deprecation notice when accessed from the container, so that the service can be made really private in 4.0.
| bool | $boolean |
| $this |
Whether this service is private.
| bool |
Sets the lazy flag of this service.
| bool | $lazy |
| $this |
Whether this service is lazy.
| bool |
Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
| bool | $boolean |
| $this |
Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
| bool |
Whether this definition is abstract, that means it merely serves as a template for other definitions.
| bool | $boolean |
| $this |
Whether this definition is abstract, that means it merely serves as a template for other definitions.
| bool |
Whether this definition is deprecated, that means it should not be called anymore.
| bool | $status | |
| string | $template | Template message to use if the definition is deprecated |
| $this |
| InvalidArgumentException | when the message template is invalid |
Whether this definition is deprecated, that means it should not be called anymore.
| bool |
Message to use if this definition is deprecated.
| string | $id | Service id relying on this definition |
| string |
Sets a configurator to call after the service is fully initialized.
| string|array | $configurator | A PHP callable |
| $this |
Gets the configurator to call after the service is fully initialized.
| callable|null | The PHP callable to call |
Is the definition autowired?
| bool |
Enables/disables autowiring.
| bool | $autowired |
| $this |
Gets bindings.
| array|BoundArgument[] |
Sets bindings.
Bindings map $named or FQCN arguments to values that should be injected in the matching parameters (of the constructor, of methods called and of controller actions).
| array | $bindings |
| $this |
Add an error that occurred when building this Definition.
| string | $error |
| $this |
Returns any errors that occurred while building this Definition.
| array |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/DependencyInjection/Definition.html