|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Sulu. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) MASSIVE ART WebServices GmbH |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Sulu\Bundle\CommentBundle\DependencyInjection; |
|
13
|
|
|
|
|
14
|
|
|
use Sulu\Bundle\PersistenceBundle\DependencyInjection\PersistenceExtensionTrait; |
|
15
|
|
|
use Symfony\Component\Config\FileLocator; |
|
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
17
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
|
18
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
|
19
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Integrates sulu_comment into symfony kernel. |
|
23
|
|
|
*/ |
|
24
|
|
|
class SuluCommentExtension extends Extension implements PrependExtensionInterface |
|
25
|
|
|
{ |
|
26
|
|
|
use PersistenceExtensionTrait; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* {@inheritdoc} |
|
30
|
|
|
*/ |
|
31
|
2 |
|
public function prepend(ContainerBuilder $container) |
|
32
|
|
|
{ |
|
33
|
2 |
|
if ($container->hasExtension('jms_serializer')) { |
|
34
|
2 |
|
$container->prependExtensionConfig( |
|
35
|
2 |
|
'jms_serializer', |
|
36
|
|
|
[ |
|
37
|
|
|
'metadata' => [ |
|
38
|
|
|
'directories' => [ |
|
39
|
|
|
[ |
|
40
|
|
|
'path' => __DIR__ . '/../Resources/config/serializer', |
|
41
|
|
|
'namespace_prefix' => 'Sulu\Bundle\CommentBundle\Entity', |
|
42
|
|
|
], |
|
43
|
|
|
], |
|
44
|
2 |
|
], |
|
45
|
|
|
] |
|
46
|
|
|
); |
|
47
|
|
|
} |
|
48
|
2 |
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* {@inheritdoc} |
|
52
|
|
|
*/ |
|
53
|
2 |
|
public function load(array $configs, ContainerBuilder $container) |
|
54
|
|
|
{ |
|
55
|
2 |
|
$configuration = new Configuration(); |
|
56
|
2 |
|
$config = $this->processConfiguration($configuration, $configs); |
|
57
|
|
|
|
|
58
|
2 |
|
$this->configurePersistence($config['objects'], $container); |
|
59
|
|
|
|
|
60
|
2 |
|
$container->setParameter('sulu_comment.types', $config['types']); |
|
61
|
2 |
|
$container->setParameter('sulu_comment.default_templates', $config['default_templates']); |
|
62
|
|
|
|
|
63
|
2 |
|
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
64
|
2 |
|
$loader->load('services.xml'); |
|
65
|
2 |
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|