1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Superdesk Web Publisher Bridge Bundle. |
5
|
|
|
* |
6
|
|
|
* Copyright 2016 Sourcefabric z.ú. and contributors. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please see the |
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @copyright 2016 Sourcefabric z.ú |
12
|
|
|
* @license http://www.superdesk.org/license |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace SWP\Bundle\BridgeBundle\DependencyInjection; |
16
|
|
|
|
17
|
|
|
use SWP\Bundle\StorageBundle\Doctrine\ORM\EntityRepository; |
18
|
|
|
use SWP\Component\Bridge\Model\Item; |
19
|
|
|
use SWP\Component\Bridge\Model\ItemInterface; |
20
|
|
|
use SWP\Component\Bridge\Model\Package; |
21
|
|
|
use SWP\Component\Bridge\Model\PackageInterface; |
22
|
|
|
use SWP\Component\Bridge\Model\Rendition; |
23
|
|
|
use SWP\Component\Bridge\Model\RenditionInterface; |
24
|
|
|
use SWP\Component\Storage\Factory\Factory; |
25
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
26
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* This is the class that validates and merges configuration from your app/config files. |
30
|
|
|
* |
31
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
32
|
|
|
*/ |
33
|
|
|
class Configuration implements ConfigurationInterface |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* {@inheritdoc} |
37
|
|
|
*/ |
38
|
|
|
public function getConfigTreeBuilder() |
39
|
|
|
{ |
40
|
|
|
$treeBuilder = new TreeBuilder(); |
41
|
|
|
$rootNode = $treeBuilder->root('swp_bridge', 'array'); |
42
|
|
|
|
43
|
|
|
$rootNode |
44
|
|
|
->children() |
45
|
|
|
->arrayNode('persistence') |
46
|
|
|
->addDefaultsIfNotSet() |
47
|
|
|
->children() |
48
|
|
|
->arrayNode('orm') |
49
|
|
|
->addDefaultsIfNotSet() |
50
|
|
|
->canBeEnabled() |
51
|
|
|
->children() |
52
|
|
|
->arrayNode('classes') |
53
|
|
|
->addDefaultsIfNotSet() |
54
|
|
|
->children() |
55
|
|
|
->arrayNode('package') |
56
|
|
|
->addDefaultsIfNotSet() |
57
|
|
|
->children() |
58
|
|
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(Package::class)->end() |
59
|
|
|
->scalarNode('repository')->defaultValue(EntityRepository::class)->end() |
60
|
|
|
->scalarNode('interface')->defaultValue(PackageInterface::class)->end() |
61
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
62
|
|
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
63
|
|
|
->end() |
64
|
|
|
->end() |
65
|
|
|
->arrayNode('item') |
66
|
|
|
->addDefaultsIfNotSet() |
67
|
|
|
->children() |
68
|
|
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(Item::class)->end() |
69
|
|
|
->scalarNode('repository')->defaultValue(EntityRepository::class)->end() |
70
|
|
|
->scalarNode('interface')->defaultValue(ItemInterface::class)->end() |
71
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
72
|
|
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
73
|
|
|
->end() |
74
|
|
|
->end() |
75
|
|
|
->arrayNode('rendition') |
76
|
|
|
->addDefaultsIfNotSet() |
77
|
|
|
->children() |
78
|
|
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(Rendition::class)->end() |
79
|
|
|
->scalarNode('repository')->defaultValue(EntityRepository::class)->end() |
80
|
|
|
->scalarNode('interface')->defaultValue(RenditionInterface::class)->end() |
81
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
82
|
|
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
83
|
|
|
->end() |
84
|
|
|
->end() |
85
|
|
|
->end() |
86
|
|
|
->end() |
87
|
|
|
->end() |
88
|
|
|
->end() // orm |
89
|
|
|
->end() |
90
|
|
|
->end() |
91
|
|
|
->arrayNode('api') |
92
|
|
|
->children() |
93
|
|
|
->scalarNode('host') |
94
|
|
|
->info('Hostname of the Content API.') |
95
|
|
|
->isRequired() |
96
|
|
|
->cannotBeEmpty() |
97
|
|
|
->end() |
98
|
|
|
->integerNode('port') |
99
|
|
|
->info('Port of the Content API.') |
100
|
|
|
->defaultValue(80) |
101
|
|
|
->end() |
102
|
|
|
->enumNode('protocol') |
103
|
|
|
->info('Protocol which will be used for connection to the Content Api.') |
104
|
|
|
->values(['http', 'https']) |
105
|
|
|
->defaultValue('https') |
106
|
|
|
->end() |
107
|
|
|
->end() |
108
|
|
|
->end() |
109
|
|
|
->arrayNode('auth') |
110
|
|
|
->children() |
111
|
|
|
->scalarNode('client_id') |
112
|
|
|
->info('Client ID for OAuth2 authentication for the Content Api.') |
113
|
|
|
->isRequired() |
114
|
|
|
->cannotBeEmpty() |
115
|
|
|
->end() |
116
|
|
|
->scalarNode('username') |
117
|
|
|
->info('Username for OAuth2 authentication for the Content Api.') |
118
|
|
|
->isRequired() |
119
|
|
|
->cannotBeEmpty() |
120
|
|
|
->end() |
121
|
|
|
->scalarNode('password') |
122
|
|
|
->info('Password for OAuth2 authentication for the Content Api.') |
123
|
|
|
->isRequired() |
124
|
|
|
->cannotBeEmpty() |
125
|
|
|
->end() |
126
|
|
|
->end() |
127
|
|
|
->end() |
128
|
|
|
->variableNode('options')->end() |
129
|
|
|
->end(); |
130
|
|
|
|
131
|
|
|
return $treeBuilder; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|