给定Symfony2配置:
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('acme');
$rootNode
->children()
->scalarNode('tempFolder')
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('logFile')
->end()
->end()
;
如何让logFile
依赖于tempFolder
,以便它就像
tempFolder + '/' + logFile
答案 0 :(得分:0)
这看起来像是您的扩展程序的作业。
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$logRealpath = sprintf("%s/%s",
rtrim($config['tempFolder'], '/'),
ltrim($config['logFile'], '/')
);
$container->setParameter('acme.log_realpath', $logRealpath);
}
然后您可以使用
访问它%acme.log_realpath%