1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the FOSRestBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace FOS\RestBundle; |
13
|
|
|
|
14
|
|
|
use FOS\RestBundle\DependencyInjection\Compiler\ConfigurationCheckPass; |
15
|
|
|
use FOS\RestBundle\DependencyInjection\Compiler\HandlerRegistryDecorationPass; |
16
|
|
|
use FOS\RestBundle\DependencyInjection\Compiler\JMSFormErrorHandlerPass; |
17
|
|
|
use FOS\RestBundle\DependencyInjection\Compiler\JMSHandlersPass; |
18
|
|
|
use FOS\RestBundle\DependencyInjection\Compiler\FormatListenerRulesPass; |
19
|
|
|
use FOS\RestBundle\DependencyInjection\Compiler\SerializerConfigurationPass; |
20
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
21
|
|
|
use Symfony\Component\DependencyInjection\Compiler\PassConfig; |
22
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @author Lukas Kahwe Smith <[email protected]> |
26
|
|
|
* @author Eriksen Costa <[email protected]> |
27
|
|
|
*/ |
28
|
|
|
class FOSRestBundle extends Bundle |
29
|
|
|
{ |
30
|
|
|
const ZONE_ATTRIBUTE = '_fos_rest_zone'; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* {@inheritdoc} |
34
|
|
|
*/ |
35
|
|
|
public function build(ContainerBuilder $container) |
36
|
|
|
{ |
37
|
|
|
$container->addCompilerPass(new SerializerConfigurationPass()); |
38
|
|
|
$container->addCompilerPass(new ConfigurationCheckPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -10); |
39
|
|
|
$container->addCompilerPass(new FormatListenerRulesPass()); |
40
|
|
|
$container->addCompilerPass(new JMSFormErrorHandlerPass()); |
41
|
|
|
$container->addCompilerPass(new JMSHandlersPass(), PassConfig::TYPE_BEFORE_REMOVING, -10); |
42
|
|
|
$container->addCompilerPass(new HandlerRegistryDecorationPass(), PassConfig::TYPE_AFTER_REMOVING); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|