Container
class Container extends Container (View source)
Extends the Drupal container to set the service ID on the created object.
Properties
| protected array | $parameters | The parameters of the container. |
from Container |
| protected array | $aliases | The aliases of the container. |
from Container |
| protected array | $serviceDefinitions | The service definitions of the container. |
from Container |
| protected array | $services | The instantiated services. |
from Container |
| protected array | $privateServices | The instantiated private services. |
from Container |
| protected array | $loading | The currently loading services. |
from Container |
| protected bool | $frozen | Whether the container parameters can still be changed. |
from Container |
Methods
{@inheritdoc}
Creates a service from a service definition.
{@inheritdoc}
Resolves arguments that represent services or variables to the real values.
Provides alternatives for a given array and key.
Provides alternatives in case a service was not found.
Provides alternatives in case a parameter was not found.
{@inheritdoc}
Details
__construct(array $container_definition = [])
Constructs a new Container instance.
get($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
{@inheritdoc}
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.
protected object
createService(array $definition, string $id)
Creates a service from a service definition.
set($id, $service)
{@inheritdoc}
has($id)
{@inheritdoc}
getParameter($name)
{@inheritdoc}
hasParameter($name)
{@inheritdoc}
setParameter($name, $value)
{@inheritdoc}
initialized($id)
{@inheritdoc}
protected array
resolveServicesAndParameters(array|object $arguments)
Resolves arguments that represent services or variables to the real values.
protected string[]
getAlternatives(string $search_key, array $keys)
Provides alternatives for a given array and key.
protected string[]
getServiceAlternatives(string $id)
Provides alternatives in case a service was not found.
protected string[]
getParameterAlternatives(string $name)
Provides alternatives in case a parameter was not found.
array
getServiceIds()
Gets all defined service IDs.
__sleep()
{@inheritdoc}