|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Superdesk Web Publisher Content 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\ContentBundle\DependencyInjection; |
|
16
|
|
|
|
|
17
|
|
|
use SWP\Bundle\ContentBundle\Doctrine\ORM\ArticleRepository; |
|
18
|
|
|
use SWP\Bundle\ContentBundle\Doctrine\ORM\FileRepository; |
|
19
|
|
|
use SWP\Bundle\ContentBundle\Doctrine\ORM\RouteRepository; |
|
20
|
|
|
use SWP\Bundle\ContentBundle\Doctrine\ORM\ArticleMediaRepository; |
|
21
|
|
|
use SWP\Bundle\ContentBundle\Doctrine\ORM\ImageRepository; |
|
22
|
|
|
use SWP\Bundle\ContentBundle\Factory\ORM\ArticleFactory; |
|
23
|
|
|
use SWP\Bundle\ContentBundle\Factory\ORM\MediaFactory; |
|
24
|
|
|
use SWP\Bundle\ContentBundle\Factory\RouteFactory; |
|
25
|
|
|
use SWP\Bundle\ContentBundle\Model\Article; |
|
26
|
|
|
use SWP\Bundle\ContentBundle\Model\ArticleInterface; |
|
27
|
|
|
use SWP\Bundle\ContentBundle\Model\ArticleMedia; |
|
28
|
|
|
use SWP\Bundle\ContentBundle\Model\ArticleMediaInterface; |
|
29
|
|
|
use SWP\Bundle\ContentBundle\Model\File; |
|
30
|
|
|
use SWP\Bundle\ContentBundle\Model\FileInterface; |
|
31
|
|
|
use SWP\Bundle\ContentBundle\Model\Image; |
|
32
|
|
|
use SWP\Bundle\ContentBundle\Model\ImageInterface; |
|
33
|
|
|
use SWP\Bundle\ContentBundle\Model\ImageRendition; |
|
34
|
|
|
use SWP\Bundle\ContentBundle\Model\ImageRenditionInterface; |
|
35
|
|
|
use SWP\Bundle\ContentBundle\Model\Route; |
|
36
|
|
|
use SWP\Bundle\ContentBundle\Model\RouteInterface; |
|
37
|
|
|
use SWP\Bundle\StorageBundle\Doctrine\ORM\EntityRepository; |
|
38
|
|
|
use SWP\Component\Storage\Factory\Factory; |
|
39
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
40
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* This is the class that validates and merges configuration from your app/config files. |
|
44
|
|
|
* |
|
45
|
1 |
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
|
46
|
|
|
*/ |
|
47
|
1 |
|
class Configuration implements ConfigurationInterface |
|
48
|
1 |
|
{ |
|
49
|
1 |
|
/** |
|
50
|
1 |
|
* {@inheritdoc} |
|
51
|
1 |
|
*/ |
|
52
|
1 |
|
public function getConfigTreeBuilder() |
|
53
|
1 |
|
{ |
|
54
|
1 |
|
$treeBuilder = new TreeBuilder(); |
|
55
|
1 |
|
$treeBuilder->root('swp_content') |
|
56
|
1 |
|
->children() |
|
57
|
1 |
|
->arrayNode('persistence') |
|
58
|
1 |
|
->addDefaultsIfNotSet() |
|
59
|
1 |
|
->children() |
|
60
|
1 |
|
->arrayNode('orm') |
|
61
|
1 |
|
->addDefaultsIfNotSet() |
|
62
|
1 |
|
->canBeEnabled() |
|
63
|
1 |
|
->children() |
|
64
|
1 |
|
->arrayNode('classes') |
|
65
|
1 |
|
->addDefaultsIfNotSet() |
|
66
|
1 |
|
->children() |
|
67
|
1 |
|
->arrayNode('article') |
|
68
|
1 |
|
->addDefaultsIfNotSet() |
|
69
|
1 |
|
->children() |
|
70
|
1 |
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(Article::class)->end() |
|
71
|
1 |
|
->scalarNode('interface')->cannotBeEmpty()->defaultValue(ArticleInterface::class)->end() |
|
72
|
1 |
|
->scalarNode('repository')->defaultValue(ArticleRepository::class)->end() |
|
73
|
1 |
|
->scalarNode('factory')->defaultValue(ArticleFactory::class)->end() |
|
74
|
1 |
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
|
75
|
1 |
|
->end() |
|
76
|
1 |
|
->end() |
|
77
|
1 |
|
->arrayNode('route') |
|
78
|
1 |
|
->addDefaultsIfNotSet() |
|
79
|
1 |
|
->children() |
|
80
|
1 |
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(Route::class)->end() |
|
81
|
1 |
|
->scalarNode('interface')->cannotBeEmpty()->defaultValue(RouteInterface::class)->end() |
|
82
|
1 |
|
->scalarNode('repository')->defaultValue(RouteRepository::class)->end() |
|
83
|
1 |
|
->scalarNode('factory')->defaultValue(RouteFactory::class)->end() |
|
84
|
1 |
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
|
85
|
1 |
|
->end() |
|
86
|
1 |
|
->end() |
|
87
|
1 |
|
->arrayNode('media') |
|
88
|
1 |
|
->addDefaultsIfNotSet() |
|
89
|
1 |
|
->children() |
|
90
|
1 |
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(ArticleMedia::class)->end() |
|
91
|
1 |
|
->scalarNode('interface')->cannotBeEmpty()->defaultValue(ArticleMediaInterface::class)->end() |
|
92
|
1 |
|
->scalarNode('repository')->defaultValue(ArticleMediaRepository::class)->end() |
|
93
|
1 |
|
->scalarNode('factory')->defaultValue(MediaFactory::class)->end() |
|
94
|
1 |
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
|
95
|
1 |
|
->end() |
|
96
|
1 |
|
->end() |
|
97
|
1 |
|
->arrayNode('image') |
|
98
|
1 |
|
->addDefaultsIfNotSet() |
|
99
|
1 |
|
->children() |
|
100
|
1 |
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(Image::class)->end() |
|
101
|
1 |
|
->scalarNode('interface')->cannotBeEmpty()->defaultValue(ImageInterface::class)->end() |
|
102
|
1 |
|
->scalarNode('repository')->defaultValue(ImageRepository::class)->end() |
|
103
|
1 |
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
|
104
|
1 |
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
|
105
|
1 |
|
->end() |
|
106
|
1 |
|
->end() |
|
107
|
|
|
->arrayNode('file') |
|
108
|
1 |
|
->addDefaultsIfNotSet() |
|
109
|
|
|
->children() |
|
110
|
|
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(File::class)->end() |
|
111
|
|
|
->scalarNode('interface')->cannotBeEmpty()->defaultValue(FileInterface::class)->end() |
|
112
|
|
|
->scalarNode('repository')->defaultValue(FileRepository::class)->end() |
|
113
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
|
114
|
|
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
|
115
|
|
|
->end() |
|
116
|
|
|
->end() |
|
117
|
|
|
->arrayNode('image_rendition') |
|
118
|
|
|
->addDefaultsIfNotSet() |
|
119
|
|
|
->children() |
|
120
|
|
|
->scalarNode('model')->cannotBeEmpty()->defaultValue(ImageRendition::class)->end() |
|
121
|
|
|
->scalarNode('interface')->cannotBeEmpty()->defaultValue(ImageRenditionInterface::class)->end() |
|
122
|
|
|
->scalarNode('repository')->defaultValue(EntityRepository::class)->end() |
|
123
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
|
124
|
|
|
->scalarNode('object_manager_name')->defaultValue(null)->end() |
|
125
|
|
|
->end() |
|
126
|
|
|
->end() |
|
127
|
|
|
->end() |
|
128
|
|
|
->end() // classes |
|
129
|
|
|
->end() |
|
130
|
|
|
->end() // orm |
|
131
|
|
|
->end() |
|
132
|
|
|
->end() |
|
133
|
|
|
->end(); |
|
134
|
|
|
|
|
135
|
|
|
return $treeBuilder; |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|