Class

Symfony\Component\DependencyInjection\Definition

class Definition

Definition represents a service definition.

Methods

__construct(string $class = null, array $arguments = array())

Constructor.

Definition setFactoryClass(string $factoryClass)

Sets the name of the class that acts as a factory using the factory method, which will be invoked statically.

string getFactoryClass()

Gets the factory class.

Definition setFactoryMethod(string $factoryMethod)

Sets the factory method able to create an instance of this class.

string getFactoryMethod()

Gets the factory method.

Definition setFactoryService(string $factoryService)

Sets the name of the service that acts as a factory using the factory method.

string getFactoryService()

Gets the factory service id.

Definition setClass(string $class)

Sets the service class.

string getClass()

Sets the service class.

Definition setArguments(array $arguments)

Sets the arguments to pass to the service constructor/factory method.

setProperties(array $properties)

getProperties()

setProperty($name, $value)

Definition addArgument(mixed $argument)

Adds an argument to pass to the service constructor/factory method.

Definition replaceArgument(integer $index, mixed $argument)

Sets a specific argument

array getArguments()

Gets the arguments to pass to the service constructor/factory method.

mixed getArgument(integer $index)

Gets an argument to pass to the service constructor/factory method.

Definition setMethodCalls(array $calls = array())

Sets the methods to call after service initialization.

Definition addMethodCall(string $method, array $arguments = array())

Adds a method to call after service initialization.

Definition removeMethodCall(string $method)

Removes a method to call after service initialization.

Boolean 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.

Definition setTags(array $tags)

Sets tags for this definition

array getTags()

Returns all tags.

array getTag(string $name)

Gets a tag by name.

Definition addTag(string $name, array $attributes = array())

Adds a tag for this definition.

Boolean hasTag(string $name)

Whether this definition has a tag with the given name

Definition clearTags()

Clears the tags for this definition.

Definition setFile(string $file)

Sets a file to require before creating the service.

string getFile()

Gets the file to require before creating the service.

Definition setScope(string $scope)

Sets the scope of the service

string getScope()

Returns the scope of the service

Definition setPublic(Boolean $boolean)

Sets the visibility of this service.

Boolean isPublic()

Whether this service is public facing

Definition setSynthetic(Boolean $boolean)

Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.

Boolean isSynthetic()

Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.

Definition setAbstract(Boolean $boolean)

Whether this definition is abstract, that means it merely serves as a template for other definitions.

Boolean isAbstract()

Whether this definition is abstract, that means it merely serves as a template for other definitions.

Definition setConfigurator(callable $callable)

Sets a configurator to call after the service is fully initialized.

callable getConfigurator()

Gets the configurator to call after the service is fully initialized.

Details

at line 49
public __construct(string $class = null, array $arguments = array())

Constructor.

Parameters

string $class The service class
array $arguments An array of arguments to pass to the service constructor

at line 72
public Definition setFactoryClass(string $factoryClass)

Sets the name of the class that acts as a factory using the factory method, which will be invoked statically.

Parameters

string $factoryClass The factory class name

Return Value

Definition The current instance

at line 86
public string getFactoryClass()

Gets the factory class.

Return Value

string The factory class name

at line 100
public Definition setFactoryMethod(string $factoryMethod)

Sets the factory method able to create an instance of this class.

Parameters

string $factoryMethod The factory method name

Return Value

Definition The current instance

at line 114
public string getFactoryMethod()

Gets the factory method.

Return Value

string The factory method name

at line 128
public Definition setFactoryService(string $factoryService)

Sets the name of the service that acts as a factory using the factory method.

Parameters

string $factoryService The factory service id

Return Value

Definition The current instance

at line 142
public string getFactoryService()

Gets the factory service id.

Return Value

string The factory service id

at line 156
public Definition setClass(string $class)

Sets the service class.

Parameters

string $class The service class

Return Value

Definition The current instance

at line 170
public string getClass()

Sets the service class.

Return Value

string The service class

at line 184
public Definition setArguments(array $arguments)

Sets the arguments to pass to the service constructor/factory method.

Parameters

array $arguments An array of arguments

Return Value

Definition The current instance

at line 194
public setProperties(array $properties)

Parameters

array $properties

at line 204
public getProperties()

at line 212
public setProperty($name, $value)

Parameters

$name
$value

at line 228
public Definition addArgument(mixed $argument)

Adds an argument to pass to the service constructor/factory method.

Parameters

mixed $argument An argument

Return Value

Definition The current instance

at line 247
public Definition replaceArgument(integer $index, mixed $argument)

Sets a specific argument

Parameters

integer $index
mixed $argument

Return Value

Definition The current instance

Exceptions

OutOfBoundsException When the replaced argument does not exist

at line 265
public array getArguments()

Gets the arguments to pass to the service constructor/factory method.

Return Value

array The array of arguments

at line 281
public mixed getArgument(integer $index)

Gets an argument to pass to the service constructor/factory method.

Parameters

integer $index

Return Value

mixed The argument value

Exceptions

OutOfBoundsException When the argument does not exist

at line 299
public Definition setMethodCalls(array $calls = array())

Sets the methods to call after service initialization.

Parameters

array $calls An array of method calls

Return Value

Definition The current instance

at line 321
public Definition addMethodCall(string $method, array $arguments = array())

Adds a method to call after service initialization.

Parameters

string $method The method name to call
array $arguments An array of arguments to pass to the method call

Return Value

Definition The current instance

Exceptions

InvalidArgumentException on empty $method param

at line 340
public Definition removeMethodCall(string $method)

Removes a method to call after service initialization.

Parameters

string $method The method name to remove

Return Value

Definition The current instance

at line 361
public Boolean hasMethodCall(string $method)

Check if the current definition has a given method to call after service initialization.

Parameters

string $method The method name to search for

Return Value

Boolean

at line 379
public array getMethodCalls()

Gets the methods to call after service initialization.

Return Value

array An array of method calls

at line 393
public Definition setTags(array $tags)

Sets tags for this definition

Parameters

array $tags

Return Value

Definition the current instance

at line 407
public array getTags()

Returns all tags.

Return Value

array An array of tags

at line 421
public array getTag(string $name)

Gets a tag by name.

Parameters

string $name The tag name

Return Value

array An array of attributes

at line 436
public Definition addTag(string $name, array $attributes = array())

Adds a tag for this definition.

Parameters

string $name The tag name
array $attributes An array of attributes

Return Value

Definition The current instance

at line 452
public Boolean hasTag(string $name)

Whether this definition has a tag with the given name

Parameters

string $name

Return Value

Boolean

at line 464
public Definition clearTags()

Clears the tags for this definition.

Return Value

Definition The current instance

at line 480
public Definition setFile(string $file)

Sets a file to require before creating the service.

Parameters

string $file A full pathname to include

Return Value

Definition The current instance

at line 494
public string getFile()

Gets the file to require before creating the service.

Return Value

string The full pathname to include

at line 508
public Definition setScope(string $scope)

Sets the scope of the service

Parameters

string $scope Whether the service must be shared or not

Return Value

Definition The current instance

at line 522
public string getScope()

Returns the scope of the service

Return Value

string

at line 536
public Definition setPublic(Boolean $boolean)

Sets the visibility of this service.

Parameters

Boolean $boolean

Return Value

Definition The current instance

at line 550
public Boolean isPublic()

Whether this service is public facing

Return Value

Boolean

at line 565
public Definition setSynthetic(Boolean $boolean)

Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.

Parameters

Boolean $boolean

Return Value

Definition the current instance

at line 580
public Boolean isSynthetic()

Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.

Return Value

Boolean

at line 595
public Definition setAbstract(Boolean $boolean)

Whether this definition is abstract, that means it merely serves as a template for other definitions.

Parameters

Boolean $boolean

Return Value

Definition the current instance

at line 610
public Boolean isAbstract()

Whether this definition is abstract, that means it merely serves as a template for other definitions.

Return Value

Boolean

at line 624
public Definition setConfigurator(callable $callable)

Sets a configurator to call after the service is fully initialized.

Parameters

callable $callable A PHP callable

Return Value

Definition The current instance

at line 638
public callable getConfigurator()

Gets the configurator to call after the service is fully initialized.

Return Value

callable The PHP callable to call