19
19
use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
20
20
21
21
/**
22
- * A compiler pass to find all cmf_request_aware services and add them to the
23
- * RequestAwareListener
22
+ * BC: A compiler pass to find all cmf_request_aware services and adjust the
23
+ * service definition.
24
24
*
25
25
* @author David Buchmann <[email protected] >
26
26
*/
@@ -31,43 +31,12 @@ class RequestAwarePass implements CompilerPassInterface
31
31
*/
32
32
public function process (ContainerBuilder $ container )
33
33
{
34
- if (version_compare (Kernel::VERSION , '2.3 ' , '< ' )) {
35
- $ this ->configureSynchronizer ($ container );
36
- } else {
37
- $ this ->makeSynchronized ($ container );
38
- }
39
- }
40
-
41
- /**
42
- * Configure the request synchronizer for symfony 2.2
43
- *
44
- * @param ContainerBuilder $container
45
- */
46
- private function configureSynchronizer (ContainerBuilder $ container )
47
- {
48
- if (!$ container ->hasDefinition ('cmf_core.listener.request_aware ' )) {
49
- return ;
50
- }
51
-
52
- $ listener = $ container ->getDefinition ('cmf_core.listener.request_aware ' );
53
34
$ services = $ container ->findTaggedServiceIds ('cmf_request_aware ' );
54
35
foreach ($ services as $ id => $ attributes ) {
55
- $ listener ->addMethodCall ('addService ' , array (new Reference ($ id )));
56
- }
57
- }
36
+ trigger_error ("Service $ id is using the deprecated tag cmf_request_aware " );
58
37
59
- /**
60
- * Make the tagged services synchronized for symfony 2.3 and later.
61
- *
62
- * @param ContainerBuilder $container
63
- */
64
- private function makeSynchronized (ContainerBuilder $ container )
65
- {
66
- $ services = $ container ->findTaggedServiceIds ('cmf_request_aware ' );
67
- foreach ($ services as $ id => $ attributes ) {
68
38
$ definition = $ container ->getDefinition ($ id );
69
39
$ definition
70
- ->setSynchronized (true )
71
40
->addMethodCall ('setRequest ' , array (
72
41
new Reference ('request ' , ContainerInterface::NULL_ON_INVALID_REFERENCE , false )
73
42
))
0 commit comments