本文整理汇总了PHP中Symfony\Component\DependencyInjection\ContainerBuilder::setExtensionConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::setExtensionConfig方法的具体用法?PHP ContainerBuilder::setExtensionConfig怎么用?PHP ContainerBuilder::setExtensionConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\DependencyInjection\ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder::setExtensionConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeConfigIntoOne
/**
* Merge configuration into one config
*
* @param ContainerBuilder $container
* @param string $name
* @param array $config
*
* @throws \RuntimeException
*/
private function mergeConfigIntoOne(ContainerBuilder $container, $name, array $config = [])
{
if (!$container instanceof OroContainerBuilder) {
throw new \RuntimeException(sprintf('%s is expected to be passed into OroPlatformExtension', 'Oro\\Bundle\\DistributionBundle\\DependencyInjection\\OroContainerBuilder'));
}
$originalConfig = $container->getExtensionConfig($name);
if (!count($originalConfig)) {
$originalConfig[] = array();
}
$mergedConfig = array_merge_recursive($originalConfig[0], $config);
$originalConfig[0] = $mergedConfig;
$container->setExtensionConfig('security', $originalConfig);
}
示例2: mergeConfigIntoOne
/**
* Merge configuration into one config
*
* @param ContainerBuilder $container
* @param string $name
* @param array $config
*
* @throws \RuntimeException
*/
private function mergeConfigIntoOne(ContainerBuilder $container, $name, array $config = [])
{
if (!$container instanceof ExtendedContainerBuilder) {
throw new \RuntimeException(sprintf('%s is expected to be passed into OroPlatformExtension', 'Oro\\Component\\DependencyInjection\\ExtendedContainerBuilder'));
}
$originalConfig = $container->getExtensionConfig($name);
if (!count($originalConfig)) {
$originalConfig[] = array();
}
$mergedConfig = ArrayUtils::arrayMergeRecursiveDistinct($originalConfig[0], $config);
$originalConfig[0] = $mergedConfig;
$container->setExtensionConfig($name, $originalConfig);
}