Skip to content

Commit 941569e

Browse files
committed
Merge branch '1.5'
Conflicts: Tests/Request/ParamFetcherTest.php
2 parents f022311 + fdd21c4 commit 941569e

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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\DependencyInjection\Compiler;
13+
14+
use Symfony\Component\DependencyInjection\ContainerBuilder;
15+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16+
17+
/**
18+
* Checks if the JMS serializer is available to be able to use the ExceptionWrapperSerializeHandler.
19+
*
20+
* @author Christian Flothmann <[email protected]>
21+
*/
22+
class ExceptionWrapperHandlerPass implements CompilerPassInterface
23+
{
24+
public function process(ContainerBuilder $container)
25+
{
26+
if (!$container->has('fos_rest.serializer.exception_wrapper_serialize_handler')) {
27+
return;
28+
}
29+
30+
if (interface_exists('JMS\Serializer\Handler\SubscribingHandlerInterface')) {
31+
return;
32+
}
33+
34+
$container->removeDefinition('fos_rest.serializer.exception_wrapper_serialize_handler');
35+
}
36+
}

FOSRestBundle.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ public function build(ContainerBuilder $container)
3434
$container->addCompilerPass(new ConfigurationCheckPass());
3535
$container->addCompilerPass(new FormatListenerRulesPass());
3636
$container->addCompilerPass(new TwigExceptionPass());
37+
$container->addCompilerPass(new ExceptionWrapperHandlerPass());
3738
}
3839
}

Tests/FOSRestBundleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testBuild()
2525
$container = $this->getMockBuilder('\Symfony\Component\DependencyInjection\ContainerBuilder')
2626
->setMethods(array('addCompilerPass'))
2727
->getMock();
28-
$container->expects($this->exactly(4))
28+
$container->expects($this->exactly(5))
2929
->method('addCompilerPass')
3030
->with($this->isInstanceOf('\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface'));
3131

0 commit comments

Comments
 (0)