You've already forked symfony-storage
version 1.0
This commit is contained in:
41
StorageBundle/DependencyInjection/Configuration.php
Normal file
41
StorageBundle/DependencyInjection/Configuration.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Bluesquare\StorageBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Generates the configuration tree builder.
|
||||
*
|
||||
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('storage');
|
||||
$root = $treeBuilder->root('storage');
|
||||
$root->useAttributeAsKey('storage_name')
|
||||
->prototype('array')
|
||||
->children()
|
||||
->scalarNode('type')->isRequired()->cannotBeEmpty()->end()
|
||||
->scalarNode('bucket')->end()
|
||||
->scalarNode('bucket_url')->end()
|
||||
->scalarNode('region')->end()
|
||||
->scalarNode('endpoint')->end()
|
||||
->arrayNode('credentials')
|
||||
->children()
|
||||
->scalarNode('key')->end()
|
||||
->scalarNode('secret')->end()
|
||||
->end()
|
||||
->end()
|
||||
->scalarNode('version')->end()
|
||||
->scalarNode('path')->end()
|
||||
->end()
|
||||
->end()
|
||||
->end();
|
||||
return ($treeBuilder);
|
||||
}
|
||||
}
|
||||
42
StorageBundle/DependencyInjection/StorageExtension.php
Normal file
42
StorageBundle/DependencyInjection/StorageExtension.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Bluesquare\StorageBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Extension\Extension;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
|
||||
class StorageExtension extends Extension
|
||||
{
|
||||
|
||||
/**
|
||||
* Loads a specific configuration.
|
||||
*
|
||||
* @throws \InvalidArgumentException When provided tag is not defined in this extension
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Ressources/config'));
|
||||
$loader->load('services.yaml');
|
||||
|
||||
$configuration = $this->getConfiguration($configs, $container);
|
||||
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$definition = $container->getDefinition('bluesquare.storage');
|
||||
$definition->setArgument(0, $config);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
public function getAlias()
|
||||
{
|
||||
// return ('bluesquare\\storage');
|
||||
return parent::getAlias(); // TODO: Change the autogenerated stub
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user