Bladeren bron

Configuration PietroBundle

master
Guillaume 3 jaren geleden
commit
adf62dfef6
3 gewijzigde bestanden met toevoegingen van 72 en 0 verwijderingen
  1. +25
    -0
      DependencyInjection/Configuration.php
  2. +33
    -0
      DependencyInjection/LcPietroExtension.php
  3. +14
    -0
      LcPietroBundle.php

+ 25
- 0
DependencyInjection/Configuration.php Bestand weergeven

@@ -0,0 +1,25 @@
<?php

namespace Lc\PietroBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('lc_pietro');
$rootNode = $treeBuilder->getRootNode();

return $treeBuilder;
}
}

+ 33
- 0
DependencyInjection/LcPietroExtension.php Bestand weergeven

@@ -0,0 +1,33 @@
<?php

namespace Lc\PietroBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class LcPietroExtension extends Extension implements PrependExtensionInterface
{

public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

foreach ($config as $parameter => $value) {
$container->setParameter(sprintf('lc_pietro.%s', $parameter), $value);
}

$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yaml');
}

public function prepend(ContainerBuilder $container)
{
/*$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/easy_admin'));
$loader->load('base.yaml');
$loader->load('entities/merchant.yaml');*/
}
}

+ 14
- 0
LcPietroBundle.php Bestand weergeven

@@ -0,0 +1,14 @@
<?php

namespace Lc\PietroBundle;

use Lc\PietroBundle\DependencyInjection\LcPietroExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class LcPietroBundle extends Bundle
{
public function getContainerExtension()
{
return new LcPietroExtension();
}
}

Laden…
Annuleren
Opslaan