class MergeExtensionConfigurationContainerBuilder
A container builder preventing using methods that wouldn't have any effect from extensions.
@internal
Hierarchy
- class \Symfony\Component\DependencyInjection\Container implements \Symfony\Component\DependencyInjection\ContainerInterface, \Symfony\Contracts\Service\ResetInterface
- class \Symfony\Component\DependencyInjection\ContainerBuilder extends \Symfony\Component\DependencyInjection\Container implements \Symfony\Component\DependencyInjection\TaggedContainerInterface
- class \Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder extends \Symfony\Component\DependencyInjection\ContainerBuilder
- class \Symfony\Component\DependencyInjection\ContainerBuilder extends \Symfony\Component\DependencyInjection\Container implements \Symfony\Component\DependencyInjection\TaggedContainerInterface
Expanded class hierarchy of MergeExtensionConfigurationContainerBuilder
File
-
vendor/
symfony/ dependency-injection/ Compiler/ MergeExtensionConfigurationPass.php, line 160
Namespace
Symfony\Component\DependencyInjection\CompilerView source
class MergeExtensionConfigurationContainerBuilder extends ContainerBuilder {
private string $extensionClass;
public function __construct(ExtensionInterface $extension, ?ParameterBagInterface $parameterBag = null) {
parent::__construct($parameterBag);
$this->extensionClass = $extension::class;
}
public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0) : static {
throw new LogicException(\sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', get_debug_type($pass), $this->extensionClass));
}
public function registerExtension(ExtensionInterface $extension) : void {
throw new LogicException(\sprintf('You cannot register extension "%s" from "%s". Extensions must be registered before the container is compiled.', get_debug_type($extension), $this->extensionClass));
}
public function compile(bool $resolveEnvPlaceholders = false) : void {
throw new LogicException(\sprintf('Cannot compile the container in extension "%s".', $this->extensionClass));
}
public function resolveEnvPlaceholders(mixed $value, string|bool|null $format = null, ?array &$usedEnvs = null) : mixed {
if (true !== $format || !\is_string($value)) {
return parent::resolveEnvPlaceholders($value, $format, $usedEnvs);
}
$bag = $this->getParameterBag();
$value = $bag->resolveValue($value);
if (!$bag instanceof EnvPlaceholderParameterBag) {
return parent::resolveEnvPlaceholders($value, true, $usedEnvs);
}
foreach ($bag->getEnvPlaceholders() as $env => $placeholders) {
if (!str_contains($env, ':')) {
continue;
}
foreach ($placeholders as $placeholder) {
if (false !== stripos($value, $placeholder)) {
throw new RuntimeException(\sprintf('Using a cast in "env(%s)" is incompatible with resolution at compile time in "%s". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.', $env, $this->extensionClass));
}
}
}
return parent::resolveEnvPlaceholders($value, true, $usedEnvs);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
Container::$aliases | protected | property | |||
Container::$compiled | private | property | |||
Container::$envCache | private | property | |||
Container::$factories | protected | property | |||
Container::$fileMap | protected | property | |||
Container::$getEnv | private | property | 1 | ||
Container::$loading | protected | property | |||
Container::$make | private static | property | |||
Container::$methodMap | protected | property | |||
Container::$parameterBag | protected | property | |||
Container::$privates | protected | property | |||
Container::$resolving | protected | property | |||
Container::$services | protected | property | |||
Container::$syntheticIds | protected | property | |||
Container::camelize | public static | function | Camelizes a string. | ||
Container::getParameter | public | function | Gets a parameter. | Overrides ContainerInterface::getParameter | |
Container::getParameterBag | public | function | Gets the service container parameter bag. | ||
Container::getService | final protected | function | @internal | ||
Container::hasParameter | public | function | Overrides ContainerInterface::hasParameter | ||
Container::initialized | public | function | Returns true if the given service has actually been initialized. | Overrides ContainerInterface::initialized | |
Container::isCompiled | public | function | Returns true if the container is compiled. | ||
Container::load | protected | function | Creates a service by requiring its factory file. | ||
Container::make | private static | function | Creates a service. | ||
Container::reset | public | function | Overrides ResetInterface::reset | ||
Container::setParameter | public | function | Overrides ContainerInterface::setParameter | 1 | |
Container::underscore | public static | function | A string to underscore. | ||
Container::__clone | private | function | |||
ContainerBuilder::$aliasDefinitions | private | property | |||
ContainerBuilder::$autoconfiguredAttributes | private | property | |||
ContainerBuilder::$autoconfiguredInstanceof | private | property | |||
ContainerBuilder::$classReflectors | private | property | |||
ContainerBuilder::$compiler | private | property | |||
ContainerBuilder::$definitions | private | property | |||
ContainerBuilder::$envCounters | private | property | |||
ContainerBuilder::$envPlaceholders | private | property | |||
ContainerBuilder::$expressionLanguage | private | property | |||
ContainerBuilder::$expressionLanguageProviders | private | property | |||
ContainerBuilder::$extensionConfigs | private | property | |||
ContainerBuilder::$extensions | private | property | |||
ContainerBuilder::$extensionsByNs | private | property | |||
ContainerBuilder::$pathsInVendor | private | property | |||
ContainerBuilder::$proxyInstantiator | private | property | |||
ContainerBuilder::$removedBindingIds | private | property | |||
ContainerBuilder::$removedIds | private | property | |||
ContainerBuilder::$resources | private | property | |||
ContainerBuilder::$trackResources | private | property | |||
ContainerBuilder::$usedTags | private | property | |||
ContainerBuilder::$vendors | private | property | |||
ContainerBuilder::addAliases | public | function | Adds the service aliases. | ||
ContainerBuilder::addDefinitions | public | function | Adds the service definitions. | ||
ContainerBuilder::addExpressionLanguageProvider | public | function | |||
ContainerBuilder::addObjectResource | public | function | Adds the object class hierarchy as resources. | ||
ContainerBuilder::addResource | public | function | |||
ContainerBuilder::autowire | public | function | Registers an autowired service definition. | ||
ContainerBuilder::callMethod | private | function | |||
ContainerBuilder::createService | private | function | Creates a service for a service definition. | ||
ContainerBuilder::deprecateParameter | public | function | Deprecates a service container parameter. | ||
ContainerBuilder::doGet | private | function | |||
ContainerBuilder::doResolveServices | private | function | |||
ContainerBuilder::fileExists | public | function | Checks whether the requested file or directory exists and registers the result for resource tracking. | ||
ContainerBuilder::findDefinition | public | function | Gets a service definition by id or alias. | ||
ContainerBuilder::findTaggedServiceIds | public | function | Returns service ids for a given tag. | Overrides TaggedContainerInterface::findTaggedServiceIds | |
ContainerBuilder::findTags | public | function | Returns all tags the defined services use. | ||
ContainerBuilder::findUnusedTags | public | function | Returns all tags not queried by findTaggedServiceIds. | ||
ContainerBuilder::get | public | function | Overrides Container::get | ||
ContainerBuilder::getAlias | public | function | |||
ContainerBuilder::getAliases | public | function | |||
ContainerBuilder::getAutoconfiguredAttributes | public | function | |||
ContainerBuilder::getAutoconfiguredInstanceof | public | function | Returns an array of ChildDefinition[] keyed by interface. | ||
ContainerBuilder::getCompiler | public | function | Returns the compiler. | ||
ContainerBuilder::getCompilerPassConfig | public | function | Returns the compiler pass config which can then be modified. | ||
ContainerBuilder::getDefinition | public | function | Gets a service definition. | ||
ContainerBuilder::getDefinitions | public | function | Gets all service definitions. | ||
ContainerBuilder::getEnv | protected | function | Fetches a variable from the environment. | Overrides Container::getEnv | |
ContainerBuilder::getEnvCounters | public | function | Get statistics about env usage. | ||
ContainerBuilder::getExpressionLanguage | private | function | |||
ContainerBuilder::getExpressionLanguageProviders | public | function | |||
ContainerBuilder::getExtension | public | function | Returns an extension by alias or namespace. | ||
ContainerBuilder::getExtensionConfig | public | function | Returns the configuration array for the given extension. | ||
ContainerBuilder::getExtensions | public | function | Returns all registered extensions. | ||
ContainerBuilder::getInitializedConditionals | public static | function | @internal | ||
ContainerBuilder::getReflectionClass | public | function | Retrieves the requested reflection class and registers it for resource tracking. | ||
ContainerBuilder::getRemovedBindingIds | public | function | Gets removed binding ids. | ||
ContainerBuilder::getRemovedIds | public | function | Gets removed service or alias ids. | Overrides Container::getRemovedIds | |
ContainerBuilder::getResources | public | function | Returns an array of resources loaded to build this configuration. | ||
ContainerBuilder::getServiceConditionals | public static | function | @internal | ||
ContainerBuilder::getServiceIds | public | function | Gets all service ids. | Overrides Container::getServiceIds | |
ContainerBuilder::has | public | function | Returns true if the container can return an entry for the given identifier. Returns false otherwise. |
Overrides Container::has | |
ContainerBuilder::hasAlias | public | function | |||
ContainerBuilder::hasDefinition | public | function | Returns true if a service definition exists under the given identifier. | ||
ContainerBuilder::hasExtension | public | function | Checks if we have an extension. | ||
ContainerBuilder::hash | public static | function | Computes a reasonably unique hash of a serializable value. | ||
ContainerBuilder::INTERNAL_TYPES | private | constant | |||
ContainerBuilder::inVendors | private | function | |||
ContainerBuilder::isTrackingResources | public | function | Checks if resources are tracked. | ||
ContainerBuilder::loadFromExtension | public | function | Loads the configuration for an extension. | ||
ContainerBuilder::log | public | function | @final | ||
ContainerBuilder::merge | public | function | Merges a ContainerBuilder with the current ContainerBuilder configuration. | ||
ContainerBuilder::parameterCannotBeEmpty | public | function | |||
ContainerBuilder::prependExtensionConfig | public | function | Prepends a config array to the configs of the given extension. | ||
ContainerBuilder::register | public | function | Registers a service definition. | 1 | |
ContainerBuilder::registerAliasForArgument | public | function | Registers an autowiring alias that only binds to a specific argument name. | ||
ContainerBuilder::registerAttributeForAutoconfiguration | public | function | Registers an attribute that will be used for autoconfiguring annotated classes. | ||
ContainerBuilder::registerChild | public | function | This method provides a fluid interface for easily registering a child service definition of the given parent service. |
||
ContainerBuilder::registerForAutoconfiguration | public | function | Returns a ChildDefinition that will be used for autoconfiguring the interface/class. | ||
ContainerBuilder::removeAlias | public | function | |||
ContainerBuilder::removeBindings | public | function | Removes bindings for a service. | ||
ContainerBuilder::removeDefinition | public | function | Removes a service definition. | ||
ContainerBuilder::resolveServices | public | function | Replaces service references by the real service instance and evaluates expressions. | ||
ContainerBuilder::set | public | function | Sets a service. | Overrides Container::set | 1 |
ContainerBuilder::setAlias | public | function | Sets an alias for an existing service. | 1 | |
ContainerBuilder::setAliases | public | function | Sets the service aliases. | ||
ContainerBuilder::setDefinition | public | function | Sets a service definition. | ||
ContainerBuilder::setDefinitions | public | function | Sets the service definitions. | ||
ContainerBuilder::setProxyInstantiator | public | function | Sets the instantiator to be used when fetching proxies. | ||
ContainerBuilder::setResources | public | function | Sets the resources for this configuration. | ||
ContainerBuilder::setResourceTracking | public | function | Sets the track resources flag. | ||
ContainerBuilder::shareService | private | function | |||
ContainerBuilder::willBeAvailable | final public static | function | Checks whether a class is available and will remain available in the "no-dev" mode of Composer. | ||
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE | public | constant | |||
ContainerInterface::IGNORE_ON_INVALID_REFERENCE | public | constant | |||
ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE | public | constant | |||
ContainerInterface::NULL_ON_INVALID_REFERENCE | public | constant | |||
ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE | public | constant | |||
MergeExtensionConfigurationContainerBuilder::$extensionClass | private | property | |||
MergeExtensionConfigurationContainerBuilder::addCompilerPass | public | function | Adds a compiler pass. | Overrides ContainerBuilder::addCompilerPass | |
MergeExtensionConfigurationContainerBuilder::compile | public | function | Compiles the container. | Overrides ContainerBuilder::compile | |
MergeExtensionConfigurationContainerBuilder::registerExtension | public | function | Overrides ContainerBuilder::registerExtension | ||
MergeExtensionConfigurationContainerBuilder::resolveEnvPlaceholders | public | function | Resolves env parameter placeholders in a string or an array. | Overrides ContainerBuilder::resolveEnvPlaceholders | |
MergeExtensionConfigurationContainerBuilder::__construct | public | function | Overrides ContainerBuilder::__construct |