IntrospectableContainerInterface deprecated
interface IntrospectableContainerInterface implements ContainerInterface
deprecated
IntrospectableContainerInterface defines additional introspection functionality for containers, allowing logic to be implemented based on a Container's state.
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) deprecated Enters the given scope. | from ContainerInterface | |
leaveScope(string $name) deprecated Leaves the current scope, and re-enters the parent scope. | from ContainerInterface | |
addScope(ScopeInterface $scope) deprecated Adds a scope to the container. | from ContainerInterface | |
bool | hasScope(string $name) deprecated Whether this container has the given scope. | from ContainerInterface |
bool | isScopeActive(string $name) deprecated Determines whether the given scope is currently active. | from ContainerInterface |
bool | initialized(string $id) Check for whether or not a service has been initialized. |
Details
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 |
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 |
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 |
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 |
bool hasParameter(string $name)
Checks if a parameter exists.
Parameters
string | $name | The parameter name |
Return Value
bool | The presence of parameter in container |
setParameter(string $name, mixed $value)
Sets a parameter.
Parameters
string | $name | The parameter name |
mixed | $value | The parameter value |
enterScope(string $name) deprecated
deprecated
Enters the given scope.
Parameters
string | $name |
leaveScope(string $name) deprecated
deprecated
Leaves the current scope, and re-enters the parent scope.
Parameters
string | $name |
addScope(ScopeInterface $scope) deprecated
deprecated
Adds a scope to the container.
Parameters
ScopeInterface | $scope |
bool hasScope(string $name) deprecated
deprecated
Whether this container has the given scope.
Parameters
string | $name |
Return Value
bool |
bool isScopeActive(string $name) deprecated
deprecated
Determines whether the given scope is currently active.
It does however not check if the scope actually exists.
Parameters
string | $name |
Return Value
bool |
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 |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.html