1111
1212namespace Cache \CacheBundle \DependencyInjection \Compiler ;
1313
14- use Cache \CacheBundle \Session \SessionHandler ;
15- use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
1614use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
1715use Symfony \Component \DependencyInjection \ContainerBuilder ;
18- use Symfony \Component \DependencyInjection \Definition ;
19- use Symfony \Component \DependencyInjection \Reference ;
2016
2117/**
2218 * Class SessionSupportCompilerPass.
2521 */
2622class SessionSupportCompilerPass implements CompilerPassInterface
2723{
28- /**
29- * @type ContainerBuilder
30- */
31- protected $ container ;
32-
3324 /**
3425 * @param ContainerBuilder $container
3526 *
@@ -47,30 +38,6 @@ public function process(ContainerBuilder $container)
4738 throw new \Exception ('Session cache support cannot be enabled if there is no session.storage service ' );
4839 }
4940
50- $ this ->enableSessionSupport ($ container , $ container ->getParameter ('cache.session ' ));
51- }
52-
53- /**
54- * Enables session support for memcached.
55- *
56- * @param array $config Configuration for bundle
57- *
58- * @throws InvalidConfigurationException
59- */
60- private function enableSessionSupport (ContainerBuilder $ container , array $ config )
61- {
62- // calculate options
63- $ sessionOptions = $ container ->getParameter ('session.storage.options ' );
64- if (isset ($ sessionOptions ['cookie_lifetime ' ]) && !isset ($ config ['cookie_lifetime ' ])) {
65- $ config ['cookie_lifetime ' ] = $ sessionOptions ['cookie_lifetime ' ];
66- }
67- // load the session handler
68- $ definition = new Definition (SessionHandler::class);
69- $ definition ->addArgument (new Reference ($ config ['service_id ' ]))
70- ->addArgument ($ config );
71-
72- $ container ->setDefinition ('cache.session_handler ' , $ definition );
73-
74- $ container ->setAlias ('session.handler ' , 'cache.session_handler ' );
41+ $ container ->setAlias ('session.handler ' , 'cache.service.session ' );
7542 }
7643}
0 commit comments