[FrameworkBundle] added configuration interface check

Added check for ConfigurationInterface to config ref dumping
command. To ensure that configuration implements needed
`getConfigTreeBuilder()` command
This commit is contained in:
everzet 2012-06-26 10:46:00 +02:00
parent d131f9d32f
commit d4a09881f1

View File

@ -17,6 +17,7 @@ use Symfony\Component\Console\Output\OutputInterface;
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
@ -102,6 +103,12 @@ EOF
'" 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);