Symfony2 API
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()

Gets 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 clearTag(string $name)

Clears all tags for a 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 setSynchronized(Boolean $boolean)

Sets the synchronized flag of this service.

Boolean isSynchronized()

Whether this service is synchronized.

Definition setLazy(Boolean $lazy)

Sets the lazy flag of this service.

Boolean isLazy()

Whether this service is lazy.

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 52
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 77
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 91
public string getFactoryClass()

Gets the factory class.

Return Value

string The factory class name

at line 105
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 119
public string getFactoryMethod()

Gets the factory method.

Return Value

string The factory method name

at line 133
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 147
public string getFactoryService()

Gets the factory service id.

Return Value

string The factory service id

at line 161
public Definition setClass(string $class)

Sets the service class.

Parameters

string $class The service class

Return Value

Definition The current instance

at line 175
public string getClass()

Gets the service class.

Return Value

string The service class

at line 189
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 199
public setProperties(array $properties)

Parameters

array $properties

at line 209
public getProperties()

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

Parameters

$name
$value

at line 233
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 252
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 270
public array getArguments()

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

Return Value

array The array of arguments

at line 286
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 304
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 326
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 345
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 366
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 384
public array getMethodCalls()

Gets the methods to call after service initialization.

Return Value

array An array of method calls

at line 398
public Definition setTags(array $tags)

Sets tags for this definition

Parameters

array $tags

Return Value

Definition the current instance

at line 412
public array getTags()

Returns all tags.

Return Value

array An array of tags

at line 426
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 441
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 457
public Boolean hasTag(string $name)

Whether this definition has a tag with the given name

Parameters

string $name

Return Value

Boolean

at line 469
public Definition clearTag(string $name)

Clears all tags for a given name.

Parameters

string $name The tag name

Return Value

Definition

at line 485
public Definition clearTags()

Clears the tags for this definition.

Return Value

Definition The current instance

at line 501
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 515
public string getFile()

Gets the file to require before creating the service.

Return Value

string The full pathname to include

at line 529
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 543
public string getScope()

Returns the scope of the service

Return Value

string

at line 557
public Definition setPublic(Boolean $boolean)

Sets the visibility of this service.

Parameters

Boolean $boolean

Return Value

Definition The current instance

at line 571
public Boolean isPublic()

Whether this service is public facing

Return Value

Boolean

at line 585
public Definition setSynchronized(Boolean $boolean)

Sets the synchronized flag of this service.

Parameters

Boolean $boolean

Return Value

Definition The current instance

at line 599
public Boolean isSynchronized()

Whether this service is synchronized.

Return Value

Boolean

at line 611
public Definition setLazy(Boolean $lazy)

Sets the lazy flag of this service.

Parameters

Boolean $lazy

Return Value

Definition The current instance

at line 623
public Boolean isLazy()

Whether this service is lazy.

Return Value

Boolean

at line 638
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 653
public Boolean isSynthetic()

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

Return Value

Boolean

at line 668
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 683
public Boolean isAbstract()

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

Return Value

Boolean

at line 697
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 711
public callable getConfigurator()

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

Return Value

callable The PHP callable to call