Skip to content

Commit

Permalink
[FrameworkBundle] added configuration interface check
Browse files Browse the repository at this point in the history
Added check for ConfigurationInterface to config ref dumping
command. To ensure that configuration implements needed
`getConfigTreeBuilder()` command
  • Loading branch information
everzet committed Jun 26, 2012
1 parent d131f9d commit d4a0988
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\Config\Definition\NodeInterface;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\PrototypedArrayNode;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* A console command for dumping available configuration reference
Expand Down Expand Up @@ -102,6 +103,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
'" does not have it\'s getConfiguration() method setup');
}

if (!$configuration instanceof ConfigurationInterface) {
throw new \LogicException(
'Configuration class "'.get_class($configuration).
'" should implement ConfigurationInterface in order to be dumpable');
}

$rootNode = $configuration->getConfigTreeBuilder()->buildTree();

$output->writeln($message);
Expand Down

0 comments on commit d4a0988

Please sign in to comment.