Symfony\Component\DependencyInjection\ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.
- Author: Fabien Potencier <fabien@symfony.com>
Synopsis
class ContainerBuilder
extends Container
implements
TaggedContainerInterface
{
- // members
- private array $extensions;
- private array $extensionsByNs;
- private array $definitions;
- private array $obsoleteDefinitions;
- private array $aliasDefinitions;
- private array $resources;
- private array $extensionConfigs;
- private Compiler $compiler;
- private $trackResources;
- private InstantiatorInterface|null $proxyInstantiator;
- // Inherited members from Container
- protected ParameterBagInterface $parameterBag;
- protected $services;
- protected $methodMap;
- protected $aliases;
- protected $scopes;
- protected $scopeChildren;
- protected $scopedServices;
- protected $scopeStacks;
- protected array $loading;
- // methods
- public void setResourceTracking()
- public Boolean isTrackingResources()
- public void setProxyInstantiator()
- public void registerExtension()
- public ExtensionInterface getExtension()
- public array getExtensions()
- public Boolean hasExtension()
- public array getResources()
- public ContainerBuilder addResource()
- public ContainerBuilder setResources()
- public ContainerBuilder addObjectResource()
- public ContainerBuilder addClassResource()
- public ContainerBuilder loadFromExtension()
- public ContainerBuilder addCompilerPass()
- public PassConfig getCompilerPassConfig()
- public Compiler getCompiler()
- public array getScopes()
- public array getScopeChildren()
- public void set()
- public void removeDefinition()
- public Boolean has()
- public get()
- public void merge()
- public array getExtensionConfig()
- public void prependExtensionConfig()
- public void compile()
- public array getServiceIds()
- public void addAliases()
- public void setAliases()
- public void setAlias()
- public void removeAlias()
- public Boolean hasAlias()
- public array getAliases()
- public Alias getAlias()
- public Definition register()
- public void addDefinitions()
- public void setDefinitions()
- public array getDefinitions()
- public Definition setDefinition()
- public Boolean hasDefinition()
- public Definition getDefinition()
- public Definition findDefinition()
- public createService()
- public mixed resolveServices()
- public array findTaggedServiceIds()
- public array findTags()
- public static array getServiceConditionals()
- private InstantiatorInterface getProxyInstantiator()
- private void synchronize()
- private void callMethod()
- private void shareService()
- // Inherited methods from Container
- public void __construct()
- public void compile()
- public Boolean isFrozen()
- public ParameterBagInterface getParameterBag()
- public mixed getParameter()
- public Boolean hasParameter()
- public void setParameter()
- public void set()
- public Boolean has()
- public get()
- public Boolean initialized()
- public array getServiceIds()
- public void enterScope()
- public void leaveScope()
- public void addScope()
- public Boolean hasScope()
- public Boolean isScopeActive()
- public static string camelize()
- public static string underscore()
Hierarchy
Extends
Implements
Members
private
- $aliasDefinitions — array
- $compiler — Symfony\Component\DependencyInjection\Compiler\Compiler
- $definitions — array
- $extensionConfigs
- $extensions — array
- $extensionsByNs — array
- $obsoleteDefinitions — array
- $proxyInstantiator — Symfony\Component\DependencyInjection\InstantiatorInterface|null
- $resources — array
- $trackResources
protected
- $aliases
- $loading
- $methodMap
- $parameterBag — Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface
- $scopeChildren
- $scopeStacks
- $scopedServices
- $scopes
- $services
Methods
private
- callMethod()
- getProxyInstantiator() — Retrieves the currently set proxy instantiator or instantiates one.
- synchronize() — Synchronizes a service change.
public
- addAliases() — Adds the service aliases.
- addClassResource() — Adds the given class hierarchy as resources.
- addCompilerPass() — Adds a compiler pass.
- addDefinitions() — Adds the service definitions.
- addObjectResource() — Adds the object class hierarchy as resources.
- addResource() — Adds a resource for this configuration.
- compile() — Compiles the container.
- createService() — Creates a service for a service definition.
- findDefinition() — Gets a service definition by id or alias.
- findTaggedServiceIds() — Returns service ids for a given tag.
- findTags() — Returns all tags the defined services use.
- get() — Gets a service.
- getAlias() — Gets an alias.
- getAliases() — Gets all defined aliases.
- getCompiler() — Returns the compiler.
- getCompilerPassConfig() — Returns the compiler pass config which can then be modified.
- getDefinition() — Gets a service definition.
- getDefinitions() — Gets all service definitions.
- getExtension() — Returns an extension by alias or namespace.
- getExtensionConfig() — Returns the configuration array for the given extension.
- getExtensions() — Returns all registered extensions.
- getResources() — Returns an array of resources loaded to build this configuration.
- getScopeChildren() — Returns all Scope children.
- getScopes() — Returns all Scopes.
- getServiceConditionals() — Returns the Service Conditionals.
- getServiceIds() — Gets all service ids.
- has() — Returns true if the given service is defined.
- hasAlias() — Returns true if an alias exists under the given identifier.
- hasDefinition() — Returns true if a service definition exists under the given identifier.
- hasExtension() — Checks if we have an extension.
- isTrackingResources() — Checks if resources are tracked.
- loadFromExtension() — Loads the configuration for an extension.
- merge() — Merges a ContainerBuilder with the current ContainerBuilder configuration.
- prependExtensionConfig() — Prepends a config array to the configs of the given extension.
- register() — Registers a service definition.
- registerExtension() — Registers an extension.
- removeAlias() — Removes an alias.
- removeDefinition() — Removes a service definition.
- resolveServices() — Replaces service references by the real service instance.
- set() — Sets a service.
- setAlias() — Sets an alias for an existing service.
- setAliases() — Sets the service aliases.
- setDefinition() — Sets a service definition.
- setDefinitions() — Sets the service definitions.
- setProxyInstantiator() — Sets the instantiator to be used when fetching proxies.
- setResourceTracking() — Sets the track resources flag.
- setResources() — Sets the resources for this configuration.
Inherited from Symfony\Component\DependencyInjection\Container
public
- addScope() — Adds a scope to the container.
- camelize() — Camelizes a string.
- compile() — Compiles the container.
- enterScope() — This is called when you enter a scope
- get() — Gets a service.
- getParameter() — Gets a parameter.
- getParameterBag() — Gets the service container parameter bag.
- getServiceIds() — Gets all service ids.
- has() — Returns true if the given service is defined.
- hasParameter() — Checks if a parameter exists.
- hasScope() — Returns whether this container has a certain scope
- initialized() — Returns true if the given service has actually been initialized
- isFrozen() — Returns true if the container parameter bag are frozen.
- isScopeActive() — Returns whether this scope is currently active
- leaveScope() — This is called to leave the current scope, and move back to the parent scope.
- set() — Sets a service.
- setParameter() — Sets a parameter.
- underscore() — A string to underscore.