class TestContainer extends Container
protected | $parameterBag | from Container | |
protected | $services | from Container | |
protected | $fileMap | from Container | |
protected | $methodMap | from Container | |
protected | $factories | from Container | |
protected | $aliases | from Container | |
protected | $loading | from Container | |
protected | $resolving | from Container | |
protected | $syntheticIds | from Container |
__construct(KernelInterface $kernel, string $privateServicesLocatorId) | ||
compile() Compiles the container. | ||
bool | isCompiled() Returns true if the container is compiled. | |
ParameterBagInterface | getParameterBag() Gets the service container parameter bag. | |
mixed | getParameter(string $name) Gets a parameter. | |
bool | hasParameter(string $name) Checks if a parameter exists. | |
setParameter(string $name, mixed $value) Sets a parameter. | ||
set(string $id, object $service) Sets a service. | ||
bool | has(string $id) Returns true if the given service is defined. | |
object | get(string $id, int $invalidBehavior = 1) Gets a service. | |
bool | initialized(string $id) Returns true if the given service has actually been initialized. | |
reset() Resets shared services from the container. | ||
array | getServiceIds() Gets all service ids. | |
array | getRemovedIds() Gets service ids that existed at compile time. | |
static string | camelize(string $id) Camelizes a string. | from Container |
static string | underscore(string $id) A string to underscore. | from Container |
object | load($file) Creates a service by requiring its factory file. | from Container |
mixed | getEnv(string $name) Fetches a variable from the environment. | from Container |
KernelInterface | $kernel | |
string | $privateServicesLocatorId |
Compiles the container.
This method does two things:
Returns true if the container is compiled.
bool |
Gets the service container parameter bag.
ParameterBagInterface | A ParameterBagInterface instance |
Gets a parameter.
string | $name | The parameter name |
mixed | The parameter value |
InvalidArgumentException | if the parameter is not defined |
Checks if a parameter exists.
string | $name | The parameter name |
bool | The presence of parameter in container |
Sets a parameter.
string | $name | The parameter name |
mixed | $value | The parameter value |
Sets a service.
Setting a service to null resets the service: has() returns false and get() behaves in the same way as if the service was never created.
string | $id | The service identifier |
object | $service | The service instance |
Returns true if the given service is defined.
string | $id | The service identifier |
bool | true if the service is defined, false otherwise |
Gets a service.
string | $id | The service identifier |
int | $invalidBehavior | The behavior when the service does not exist |
object | The associated service |
ServiceCircularReferenceException | When a circular reference is detected |
ServiceNotFoundException | When the service is not defined |
Exception | if an exception has been thrown when the service has been resolved |
Returns true if the given service has actually been initialized.
string | $id |
bool | true if the service has been initialized, false otherwise |
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.
Gets all service ids.
array | An array of all defined service ids |
Gets service ids that existed at compile time.
array |
Camelizes a string.
string | $id | A string to camelize |
string | The camelized string |
A string to underscore.
string | $id | The string to underscore |
string | The underscored string |
Creates a service by requiring its factory file.
$file |
object | The service created by the file |
Fetches a variable from the environment.
string | $name | The name of the environment variable |
mixed | The value to use for the provided environment variable name |
EnvNotFoundException | When the environment variable is not found and has no default value |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Bundle/FrameworkBundle/Test/TestContainer.html