<?php
namespace WAM\Bundle\RoutingBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use WAM\Bundle\RoutingBundle\Entity\AutoRoute;
use WAM\Bundle\RoutingBundle\Entity\Url;
/**
* Class Configuration.
*
* @author David Velasco <dvelasco@wearemarketing.com>
*/
class Configuration implements ConfigurationInterface
{
const ROUTING_BREADCRUMB = 'WAM\Bundle\RoutingBundle\Model\RoutingBreadcrumb';
const DEFAULT_SEPARATOR = ' / ';
const DEFAULT_VERSION = 'complete_version';
const DEFAULT_DEAD_LINK_PERMANENT = true;
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$treeBuilder->root('wam_routing')
->children()
->variableNode('version')
->defaultValue(self::DEFAULT_VERSION)
->end()
->arrayNode('breadcrumb')
->addDefaultsIfNotSet()
->children()
->scalarNode('separator')->cannotBeEmpty()->defaultValue(self::DEFAULT_SEPARATOR)->end()
->arrayNode('classes')->defaultValue([self::ROUTING_BREADCRUMB])
->prototype('scalar')->end()
->end()
->end()
->end()
->scalarNode('route_class')->defaultValue(AutoRoute::class)->end()
->scalarNode('url_class')->isRequired()->end()
->arrayNode('dead_links')
->canBeEnabled()
->addDefaultsIfNotSet()
->children()
->arrayNode('classes')
->prototype('array')
->children()
->scalarNode('class')->end()
->scalarNode('redirect_to_route')->end()
->booleanNode('permanent')->treatNullLike(true)->end()
->end()
->end()
->end()
->scalarNode('fallback_redirect_to_route')->defaultNull()->end()
->scalarNode('fallback_permanent')->cannotBeEmpty()->defaultValue(self::DEFAULT_DEAD_LINK_PERMANENT)->end()
->end()
->end()
->end()
->end();
return $treeBuilder;
}
}