Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed DIC configuration class. #13

Closed
wants to merge 1 commit into from

2 participants

@pjedrzejewski

Hello,

Before that, the default values were not set, now they are and also, class follows best practices.

@stof stof commented on the diff
DependencyInjection/Configuration.php
((27 lines not shown))
$rootNode
+ ->addDefaultsIfNotSet()
@stof Collaborator
stof added a note

this is totally useless on the root node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@stof stof closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 23, 2011
  1. @pjedrzejewski
This page is out of date. Refresh to see the latest.
View
16 DependencyInjection/Configuration.php
@@ -2,26 +2,24 @@
namespace Symfony\Bundle\DoctrineMigrationsBundle\DependencyInjection;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* DoctrineMigrationsExtension configuration structure.
*
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
+ * @author Paweł Jędrzejewski <pjedrzejewski@diweb.pl>
*/
-class Configuration
+class Configuration implements ConfigurationInterface
{
- /**
- * Generates the configuration tree.
- *
- * @return \Symfony\Component\Config\Definition\ArrayNode The config tree
- */
- public function getConfigTree()
+ public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
- $rootNode = $treeBuilder->root('doctrine_migrations', 'array');
+ $rootNode = $treeBuilder->root('doctrine_migrations');
$rootNode
+ ->addDefaultsIfNotSet()
@stof Collaborator
stof added a note

this is totally useless on the root node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
->children()
->scalarNode('dir_name')->defaultValue('%kernel.root_dir%/DoctrineMigrations')->cannotBeEmpty()->end()
->scalarNode('namespace')->defaultValue('Application\Migrations')->cannotBeEmpty()->end()
@@ -30,6 +28,6 @@ public function getConfigTree()
->end()
;
- return $treeBuilder->buildTree();
+ return $treeBuilder;
}
}
View
2  DependencyInjection/DoctrineMigrationsExtension.php
@@ -33,7 +33,7 @@ public function load(array $configs, ContainerBuilder $container)
$processor = new Processor();
$configuration = new Configuration();
- $config = $processor->process($configuration->getConfigTree(), $configs);
+ $config = $processor->processConfiguration($configuration, $configs);
foreach ($config as $key => $value) {
$container->setParameter($this->getAlias().'.'.$key, $value);
Something went wrong with that request. Please try again.