symfony-storage/StorageBundle/DependencyInjection/StorageExtension.php

52 lines
1.7 KiB
PHP
Raw Normal View History

2019-02-20 11:24:22 +01:00
<?php
2019-02-20 11:29:03 +01:00
namespace Bluesquare\StorageBundle\DependencyInjection;
2019-02-20 11:24:22 +01:00
use Symfony\Component\Config\FileLocator;
2019-02-21 14:29:58 +01:00
use Symfony\Component\DependencyInjection\Container;
2019-02-20 11:24:22 +01:00
use Symfony\Component\DependencyInjection\ContainerBuilder;
2019-02-20 12:28:19 +01:00
use Symfony\Component\DependencyInjection\Definition;
2019-02-20 11:24:22 +01:00
use Symfony\Component\DependencyInjection\Extension\Extension;
2019-02-21 14:31:01 +01:00
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
2019-02-20 11:24:22 +01:00
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
2019-02-21 14:43:19 +01:00
class StorageExtension extends Extension
2019-02-20 11:24:22 +01:00
{
/**
* 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');
2019-02-21 15:14:16 +01:00
$loader->load('import.yaml');
2019-02-21 13:26:45 +01:00
// $sLoader = new YamlFileLoader($container, new FileLocator('/config/packages/bluesquare'));
// $sLoader->load('storage.yaml');
2019-02-21 15:07:24 +01:00
// dump($container->get('kernel')->getProjectDir()); die;
2019-02-20 11:24:22 +01:00
$configuration = $this->getConfiguration($configs, $container);
2019-02-21 14:29:58 +01:00
2019-02-20 11:24:22 +01:00
$config = $this->processConfiguration($configuration, $configs);
2019-02-21 15:14:16 +01:00
dump($config); die;
2019-02-21 14:22:10 +01:00
// dump(new FileLocator('/config/packages/bluesquare')); die;
2019-02-21 13:36:13 +01:00
2019-02-21 13:26:45 +01:00
// dump($sLoader, $container, $configuration, $config); die;
2019-02-21 12:53:47 +01:00
2019-02-20 12:19:03 +01:00
$definition = $container->getDefinition('bluesquare.storage');
2019-02-20 12:31:39 +01:00
$definition->setArgument(0, $config);
2019-02-20 12:19:03 +01:00
2019-02-20 11:24:22 +01:00
return $config;
}
2019-02-21 14:29:58 +01:00
2019-02-20 11:24:22 +01:00
public function getAlias()
{
2019-02-21 15:13:08 +01:00
// return ('bluesquare\\storage');
return parent::getAlias(); // TODO: Change the autogenerated stub
2019-02-20 11:24:22 +01:00
}
}