1919use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
2020
2121/**
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.
2424 *
2525 * @author David Buchmann <mail@davidbu.ch>
2626 */
@@ -31,43 +31,12 @@ class RequestAwarePass implements CompilerPassInterface
3131 */
3232 public function process (ContainerBuilder $ container )
3333 {
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 ' );
5334 $ services = $ container ->findTaggedServiceIds ('cmf_request_aware ' );
5435 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 " );
5837
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 ) {
6838 $ definition = $ container ->getDefinition ($ id );
6939 $ definition
70- ->setSynchronized (true )
7140 ->addMethodCall ('setRequest ' , array (
7241 new Reference ('request ' , ContainerInterface::NULL_ON_INVALID_REFERENCE , false )
7342 ))
0 commit comments