ResettableContainerInterface (Component\DependencyInjection)
Symfony\Component\DependencyInjection\ResettableContainerInterface
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, string $scope = self::SCOPE_CONTAINER) Sets a service. | from ContainerInterface | |
object | get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) Gets a service. | from ContainerInterface |
bool | has(string $id) Returns true if the given service is defined. | from ContainerInterface |
mixed | getParameter(string $name) Gets a parameter. | from ContainerInterface |
bool | hasParameter(string $name) Checks if a parameter exists. | from ContainerInterface |
setParameter(string $name, mixed $value) Sets a parameter. | from ContainerInterface | |
enterScope(string $name) Enters the given scope. | from ContainerInterface | |
leaveScope(string $name) Leaves the current scope, and re-enters the parent scope. | from ContainerInterface | |
addScope(ScopeInterface $scope) Adds a scope to the container. | from ContainerInterface | |
bool | hasScope(string $name) Whether this container has the given scope. | from ContainerInterface |
bool | isScopeActive(string $name) Determines whether the given scope is currently active. | from ContainerInterface |
reset() Resets shared services from the container. |
Details
public 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.
public object get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)
Gets a service.
public bool has(string $id)
Returns true if the given service is defined.
public mixed getParameter(string $name)
Gets a parameter.
public bool hasParameter(string $name)
Checks if a parameter exists.
public setParameter(string $name, mixed $value)
Sets a parameter.
public enterScope(string $name)
Enters the given scope.
public leaveScope(string $name)
Leaves the current scope, and re-enters the parent scope.
public addScope(ScopeInterface $scope)
Adds a scope to the container.
public bool hasScope(string $name)
Whether this container has the given scope.
public bool isScopeActive(string $name)
Determines whether the given scope is currently active.
It does however not check if the scope actually exists.
public 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.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/DependencyInjection/ResettableContainerInterface.html