|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the MilioooMessageBundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Michiel boeckaert <[email protected]> |
|
7
|
|
|
* This source file is subject to the MIT license that is bundled |
|
8
|
|
|
* with this source code in the file LICENSE. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Miliooo\MessagingBundle\DependencyInjection; |
|
12
|
|
|
|
|
13
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
14
|
|
|
use Symfony\Component\Config\FileLocator; |
|
15
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
16
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* This is the class that loads and manages your bundle configuration |
|
20
|
|
|
* |
|
21
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
|
22
|
|
|
*/ |
|
23
|
|
|
class MilioooMessagingExtension extends Extension |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* {@inheritDoc} |
|
27
|
|
|
*/ |
|
28
|
|
|
public function load(array $configs, ContainerBuilder $container) |
|
29
|
|
|
{ |
|
30
|
|
|
$configuration = new Configuration(); |
|
31
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
|
32
|
|
|
|
|
33
|
|
|
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
34
|
|
|
$loader->load('builders.xml'); |
|
35
|
|
|
$loader->load('config.xml'); |
|
36
|
|
|
$loader->load('controller.xml'); |
|
37
|
|
|
$loader->load('form.xml'); |
|
38
|
|
|
$loader->load('managers.xml'); |
|
39
|
|
|
$loader->load('specifications.xml'); |
|
40
|
|
|
$loader->load('thread_providers.xml'); |
|
41
|
|
|
$loader->load('user.xml'); |
|
42
|
|
|
$loader->load('validators.xml'); |
|
43
|
|
|
|
|
44
|
|
|
$container->setParameter('miliooo_messaging.thread_class', $config['thread_class']); |
|
45
|
|
|
$container->setParameter('miliooo_messaging.thread_meta_class', $config['thread_meta_class']); |
|
46
|
|
|
$container->setParameter('miliooo_messaging.message_class', $config['message_class']); |
|
47
|
|
|
$container->setParameter('miliooo_messaging.message_meta_class', $config['message_meta_class']); |
|
48
|
|
|
$container->setParameter('miliooo_messaging.new_thread_form.model', $config['new_thread_form']['model']); |
|
49
|
|
|
$container->setAlias('miliooo_messaging.new_thread_form.type', $config['new_thread_form']['type']); |
|
50
|
|
|
$container->setAlias('miliooo_messaging.participant_provider', $config['participant_provider']); |
|
51
|
|
|
$container->setAlias('miliooo_messaging.new_thread_form.factory', $config['new_thread_form']['factory']); |
|
52
|
|
|
$container->setAlias('miliooo_messaging.username_object_transformer', $config['username_object_transformer']); |
|
53
|
|
|
|
|
54
|
|
|
$container->setAlias('miliooo_messaging.specification.can_message_recipient', $config['specification']['can_message_recipient']); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|