interface TaggedContainerInterface implements ContainerInterface

TaggedContainerInterface is the interface implemented when a container knows how to deals with tags.

Methods

set(string $id, object $service, string $scope = self::SCOPE_CONTAINER)

Sets a service.

object
get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)

Gets a service.

bool
has(string $id)

Returns true if the given service is defined.

mixed
getParameter(string $name)

Gets a parameter.

bool
hasParameter(string $name)

Checks if a parameter exists.

setParameter(string $name, mixed $value)

Sets a parameter.

enterScope(string $name) deprecated

Enters the given scope.

leaveScope(string $name) deprecated

Leaves the current scope, and re-enters the parent scope.

addScope(ScopeInterface $scope) deprecated

Adds a scope to the container.

bool
hasScope(string $name) deprecated

Whether this container has the given scope.

bool
isScopeActive(string $name) deprecated

Determines whether the given scope is currently active.

array
findTaggedServiceIds(string $name)

Returns service ids for a given tag.

Details

in ContainerInterface at line line 41
set(string $id, object $service, string $scope = self::SCOPE_CONTAINER)

Sets a service.

Note: The $scope parameter is deprecated since version 2.8 and will be removed in 3.0.

Parameters

string $id The service identifier
object $service The service instance
string $scope The scope of the service

in ContainerInterface at line line 56
object get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)

Gets a service.

Parameters

string $id The service identifier
int $invalidBehavior The behavior when the service does not exist

Return Value

object The associated service

Exceptions

ServiceCircularReferenceException When a circular reference is detected
ServiceNotFoundException When the service is not defined

See also

Reference

in ContainerInterface at line line 65
bool has(string $id)

Returns true if the given service is defined.

Parameters

string $id The service identifier

Return Value

bool true if the service is defined, false otherwise

in ContainerInterface at line line 76
mixed getParameter(string $name)

Gets a parameter.

Parameters

string $name The parameter name

Return Value

mixed The parameter value

Exceptions

InvalidArgumentException if the parameter is not defined

in ContainerInterface at line line 85
bool hasParameter(string $name)

Checks if a parameter exists.

Parameters

string $name The parameter name

Return Value

bool The presence of parameter in container

in ContainerInterface at line line 93
setParameter(string $name, mixed $value)

Sets a parameter.

Parameters

string $name The parameter name
mixed $value The parameter value

in ContainerInterface at line line 102
enterScope(string $name) deprecated

deprecated since version 2.8, to be removed in 3.0.

Enters the given scope.

Parameters

string $name

in ContainerInterface at line line 111
leaveScope(string $name) deprecated

deprecated since version 2.8, to be removed in 3.0.

Leaves the current scope, and re-enters the parent scope.

Parameters

string $name

in ContainerInterface at line line 120
addScope(ScopeInterface $scope) deprecated

deprecated since version 2.8, to be removed in 3.0.

Adds a scope to the container.

Parameters

ScopeInterface $scope

in ContainerInterface at line line 131
bool hasScope(string $name) deprecated

deprecated since version 2.8, to be removed in 3.0.

Whether this container has the given scope.

Parameters

string $name

Return Value

bool

in ContainerInterface at line line 144
bool isScopeActive(string $name) deprecated

deprecated since version 2.8, to be removed in 3.0.

Determines whether the given scope is currently active.

It does however not check if the scope actually exists.

Parameters

string $name

Return Value

bool

at line line 28
array findTaggedServiceIds(string $name)

Returns service ids for a given tag.

Parameters

string $name The tag name

Return Value

array An array of tags