|
11 | 11 |
|
12 | 12 | namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; |
13 | 13 |
|
14 | | -use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; |
15 | | -use Symfony\Component\DependencyInjection\ContainerBuilder; |
16 | | -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
17 | | -use Symfony\Component\DependencyInjection\Exception\RuntimeException; |
| 14 | +@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use Symfony\Component\Serializer\DependencyInjection\SerializerPass instead.', SerializerPass::class), E_USER_DEPRECATED); |
| 15 | + |
| 16 | +use Symfony\Component\Serializer\DependencyInjection\SerializerPass as BaseSerializerPass; |
18 | 17 |
|
19 | 18 | /** |
20 | 19 | * Adds all services with the tags "serializer.encoder" and "serializer.normalizer" as |
21 | 20 | * encoders and normalizers to the Serializer service. |
22 | 21 | * |
| 22 | + * @deprecated since version 3.3, to be removed in 4.0. Use {@link BaseSerializerPass} instead. |
| 23 | + * |
23 | 24 | * @author Javier Lopez <f12loalf@gmail.com> |
24 | 25 | */ |
25 | | -class SerializerPass implements CompilerPassInterface |
| 26 | +class SerializerPass extends BaseSerializerPass |
26 | 27 | { |
27 | | - use PriorityTaggedServiceTrait; |
28 | | - |
29 | | - public function process(ContainerBuilder $container) |
30 | | - { |
31 | | - if (!$container->hasDefinition('serializer')) { |
32 | | - return; |
33 | | - } |
34 | | - |
35 | | - // Looks for all the services tagged "serializer.normalizer" and adds them to the Serializer service |
36 | | - $normalizers = $this->findAndSortTaggedServices('serializer.normalizer', $container); |
37 | | - |
38 | | - if (empty($normalizers)) { |
39 | | - throw new RuntimeException('You must tag at least one service as "serializer.normalizer" to use the Serializer service'); |
40 | | - } |
41 | | - $container->getDefinition('serializer')->replaceArgument(0, $normalizers); |
42 | | - |
43 | | - // Looks for all the services tagged "serializer.encoders" and adds them to the Serializer service |
44 | | - $encoders = $this->findAndSortTaggedServices('serializer.encoder', $container); |
45 | | - if (empty($encoders)) { |
46 | | - throw new RuntimeException('You must tag at least one service as "serializer.encoder" to use the Serializer service'); |
47 | | - } |
48 | | - $container->getDefinition('serializer')->replaceArgument(1, $encoders); |
49 | | - } |
50 | 28 | } |
0 commit comments