private function addDoctrineSection()
    {
        $tree = new TreeBuilder();
        $node = $tree->root('doctrine');

        $node
            ->canBeEnabled()
            ->addDefaultsIfNotSet()
            ->children()
                ->booleanNode('use_tagging')
                    ->defaultTrue()
                ->end()
            ->end();

        $this->normalizeEnabled($node);

        $types = ['metadata', 'result', 'query'];
        foreach ($types as $type) {
            $node->children()
                    ->arrayNode($type)
                        ->canBeUnset()
                        ->children()
                            ->scalarNode('service_id')->isRequired()->end()
                            ->arrayNode('entity_managers')
                                ->defaultValue([])
                                ->beforeNormalization()
                                    ->ifString()
                                    ->then(
                                        function ($v) {
                                            return (array) $v;
                                        }
                                    )
                                    ->end()
                                    ->prototype('scalar')->end()
                                ->end()
                            ->arrayNode('document_managers')
                                ->defaultValue([])
                                ->beforeNormalization()
                                    ->ifString()
                                    ->then(
                                        function ($v) {
                                            return (array) $v;
                                        }
                                    )
                                ->end()
                                ->prototype('scalar')->end()
                            ->end()
                    ->end()
                ->end();
        }

        return $node;
    }