File tree 3 files changed +45
-0
lines changed
DependencyInjection/Compiler
3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1
1
Changelog
2
2
=========
3
3
4
+ 1.3.15
5
+ ------
6
+
7
+ * Fix session_listener decoration when session is not enabled.
8
+
4
9
1.3.14
5
10
------
6
11
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the FOSHttpCacheBundle 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 \HttpCacheBundle \DependencyInjection \Compiler ;
13
+
14
+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
15
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
16
+
17
+ /**
18
+ * Remove the session listener decorator again if the application has no session listener.
19
+ *
20
+ * This will happen on some APIs when the session system is not activated.
21
+ */
22
+ class SessionListenerRemovePass implements CompilerPassInterface
23
+ {
24
+ /**
25
+ * {@inheritdoc}
26
+ */
27
+ public function process (ContainerBuilder $ container )
28
+ {
29
+ if ($ container ->has ('session_listener ' )) {
30
+ return ;
31
+ }
32
+
33
+ $ container ->removeDefinition ('fos_http_cache.user_context.session_listener ' );
34
+ }
35
+ }
Original file line number Diff line number Diff line change 15
15
use FOS \HttpCacheBundle \DependencyInjection \Compiler \SecurityContextPass ;
16
16
use FOS \HttpCacheBundle \DependencyInjection \Compiler \TagSubscriberPass ;
17
17
use FOS \HttpCacheBundle \DependencyInjection \Compiler \HashGeneratorPass ;
18
+ use FOS \HttpCacheBundle \DependencyInjection \Compiler \SessionListenerRemovePass ;
18
19
use Symfony \Component \DependencyInjection \ContainerBuilder ;
19
20
use Symfony \Component \HttpKernel \Bundle \Bundle ;
21
+ use Symfony \Component \HttpKernel \Kernel ;
20
22
21
23
class FOSHttpCacheBundle extends Bundle
22
24
{
@@ -29,5 +31,8 @@ public function build(ContainerBuilder $container)
29
31
$ container ->addCompilerPass (new SecurityContextPass ());
30
32
$ container ->addCompilerPass (new TagSubscriberPass ());
31
33
$ container ->addCompilerPass (new HashGeneratorPass ());
34
+ if (version_compare (Kernel::VERSION , '3.4 ' , '>= ' )) {
35
+ $ container ->addCompilerPass (new SessionListenerRemovePass ());
36
+ }
32
37
}
33
38
}
You can’t perform that action at this time.
0 commit comments