Class Symfony\Component\DependencyInjection\Container

implements ContainerInterface, ResetInterface

Container is a dependency injection container.

It gives access to object instances (services). Services and parameters are simple key/pair stores. The container can have four possible behaviors when a service does not exist (or is not initialized for the last case):

  • EXCEPTION_ON_INVALID_REFERENCE: Throws an exception at compilation time (the default)
  • NULL_ON_INVALID_REFERENCE: Returns null
  • IGNORE_ON_INVALID_REFERENCE: Ignores the wrapping command asking for the reference (for instance, ignore a setter if the service does not exist)
  • IGNORE_ON_UNINITIALIZED_REFERENCE: Ignores/returns null for uninitialized services or invalid references
  • RUNTIME_EXCEPTION_ON_INVALID_REFERENCE: Throws an exception at runtime
Methods
Constants inherited from Symfony\Component\DependencyInjection\ContainerInterface
RUNTIME_EXCEPTION_ON_INVALID_REFERENCE, EXCEPTION_ON_INVALID_REFERENCE, NULL_ON_INVALID_REFERENCE, IGNORE_ON_INVALID_REFERENCE, IGNORE_ON_UNINITIALIZED_REFERENCE
Properties