Completed
Pull Request — master (#571)
by Rafał
12:29
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 35

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 9.36
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Plan Bundle.
7
 *
8
 * Copyright 2018 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2018 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\PlanBundle\DependencyInjection;
18
19
use SWP\Bundle\StorageBundle\Doctrine\ORM\EntityRepository;
20
use SWP\Component\Plan\Model\Plan;
21
use SWP\Component\Plan\Model\PlanInterface;
22
use SWP\Component\Storage\Factory\Factory;
23
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
24
use Symfony\Component\Config\Definition\ConfigurationInterface;
25
26
class Configuration implements ConfigurationInterface
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getConfigTreeBuilder()
32
    {
33
        $treeBuilder = new TreeBuilder();
34
        $treeBuilder->root('swp_plan')
35
            ->children()
36
                ->arrayNode('persistence')
37
                    ->addDefaultsIfNotSet()
38
                    ->children()
39
                        ->arrayNode('orm')
40
                            ->addDefaultsIfNotSet()
41
                            ->canBeEnabled()
42
                            ->children()
43
                                ->arrayNode('classes')
44
                                    ->addDefaultsIfNotSet()
45
                                    ->children()
46
                                        ->arrayNode('plan')
47
                                            ->addDefaultsIfNotSet()
48
                                            ->children()
49
                                                ->scalarNode('model')->cannotBeEmpty()->defaultValue(Plan::class)->end()
50
                                                ->scalarNode('repository')->defaultValue(EntityRepository::class)->end()
51
                                                ->scalarNode('interface')->defaultValue(PlanInterface::class)->end()
52
                                                ->scalarNode('factory')->defaultValue(Factory::class)->end()
53
                                                ->scalarNode('object_manager_name')->defaultValue(null)->end()
54
                                            ->end()
55
                                        ->end()
56
                                    ->end()
57
                                ->end()
58
                            ->end()
59
                        ->end()
60
                    ->end()
61
                ->end()
62
            ->end();
63
64
        return $treeBuilder;
65
    }
66
}
67