Boot filesystems for a specified domain
This commit is contained in:
@@ -52,6 +52,11 @@ class KnpGaufretteExtension extends Extension
|
||||
|
||||
$container->getDefinition('knp_gaufrette.filesystem_map')
|
||||
->replaceArgument(0, $map);
|
||||
|
||||
if (isset($config['stream_wrapper'])) {
|
||||
$container->setParameter('knp_gaufrette.stream_wrapper.protocol', $config['stream_wrapper']['protocol']);
|
||||
$container->setParameter('knp_gaufrette.stream_wrapper.filesystems', $config['stream_wrapper']['filesystems']);
|
||||
}
|
||||
}
|
||||
|
||||
private function createAdapter($name, array $config, ContainerBuilder $container, array $factories)
|
||||
|
||||
@@ -37,6 +37,7 @@ class MainConfiguration implements ConfigurationInterface
|
||||
|
||||
$this->addAdaptersSection($rootNode, $this->factories);
|
||||
$this->addFilesystemsSection($rootNode);
|
||||
$this->addStreamWrapperSection($rootNode);
|
||||
|
||||
$rootNode
|
||||
// add a faux-entry for factories, so that no validation error is thrown
|
||||
@@ -84,4 +85,30 @@ class MainConfiguration implements ConfigurationInterface
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
private function addStreamWrapperSection(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
->children()
|
||||
->arrayNode('stream_wrapper')
|
||||
->children()
|
||||
->scalarNode('protocol')->defaultValue('gaufrette')->end()
|
||||
->arrayNode('filesystems')
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($array) {
|
||||
return !(bool)count(array_filter(array_keys($array), 'is_string'));
|
||||
})
|
||||
->then(function ($array) {
|
||||
return array_combine($array, $array);
|
||||
})
|
||||
->end()
|
||||
->useAttributeAsKey('key')
|
||||
->prototype('scalar')
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user