interface ResettableContainerInterface implements ContainerInterface

ResettableContainerInterface defines additional resetting functionality for containers, allowing to release shared services when the container is not needed anymore.

Methods

set(string $id, object $service)

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.

bool
initialized(string $id)

Check for whether or not a service has been initialized.

mixed
getParameter(string $name)

Gets a parameter.

bool
hasParameter(string $name)

Checks if a parameter exists.

setParameter(string $name, mixed $value)

Sets a parameter.

reset()

Resets shared services from the container.

Details

in ContainerInterface at line 38
set(string $id, object $service)

Sets a service.

Parameters

string $id The service identifier
object $service The service instance

in ContainerInterface at line 53
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 62
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 71
bool initialized(string $id)

Check for whether or not a service has been initialized.

Parameters

string $id

Return Value

bool true if the service has been initialized, false otherwise

in ContainerInterface at line 82
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 91
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 99
setParameter(string $name, mixed $value)

Sets a parameter.

Parameters

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

at line 30
reset()

Resets shared services from the container.

The container is not intended to be used again after being reset in a normal workflow. This method is meant as a way to release references for ref-counting. A subsequent call to ContainerInterface::get will recreate a new instance of the shared service.