Definition
Definition
class Definition
Definition represents a service definition.
Methods
__construct(string|null $class = null, array $arguments = array()) | ||
$this | setFactory(string|array $factory) Sets a factory. | |
string|array | getFactory() Gets the factory. | |
$this | setDecoratedService(null|string $id, null|string $renamedId = null, int $priority) Sets the service that this service is decorating. | |
null|array | getDecoratedService() Gets the service that decorates this service. | |
$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. | |
setProperties(array $properties) | ||
getProperties() | ||
setProperty($name, $value) | ||
$this | addArgument(mixed $argument) Adds an argument to pass to the service constructor/factory method. | |
$this | replaceArgument(int $index, mixed $argument) Sets a specific argument. | |
array | getArguments() Gets the arguments to pass to the service constructor/factory method. | |
mixed | getArgument(int $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 | 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. | |
Definition | 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 | 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. | |
Definition | 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(callable $callable) 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. | |
Definition | setAutowiringTypes(array $types) Sets types that will default to this definition. | |
bool | isAutowired() Is the definition autowired? | |
Definition | setAutowired(bool $autowired) Sets autowired. | |
string[] | getAutowiringTypes() Gets autowiring types that will default to this definition. | |
Definition | addAutowiringType(string $type) Adds a type that will default to this definition. | |
Definition | removeAutowiringType(string $type) Removes a type. | |
bool | hasAutowiringType(string $type) Will this definition default for the given type? |
Details
__construct(string|null $class = null, array $arguments = array())
$this setFactory(string|array $factory)
Sets a factory.
string|array getFactory()
Gets the factory.
$this setDecoratedService(null|string $id, null|string $renamedId = null, int $priority)
Sets the service that this service is decorating.
null|array getDecoratedService()
Gets the service that decorates this service.
$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.
setProperties(array $properties)
getProperties()
setProperty($name, $value)
$this addArgument(mixed $argument)
Adds an argument to pass to the service constructor/factory method.
$this replaceArgument(int $index, mixed $argument)
Sets a specific argument.
array getArguments()
Gets the arguments to pass to the service constructor/factory method.
mixed getArgument(int $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 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.
Definition 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 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.
Definition 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(callable $callable)
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.
Definition setAutowiringTypes(array $types)
Sets types that will default to this definition.
bool isAutowired()
Is the definition autowired?
Definition setAutowired(bool $autowired)
Sets autowired.
string[] getAutowiringTypes()
Gets autowiring types that will default to this definition.
Definition addAutowiringType(string $type)
Adds a type that will default to this definition.
Definition removeAutowiringType(string $type)
Removes a type.
bool hasAutowiringType(string $type)
Will this definition default for the given type?
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.1/Symfony/Component/DependencyInjection/Definition.html