File tree Expand file tree Collapse file tree 3 files changed +46
-2
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the FOSCommentBundle package.
5
+ *
6
+ * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
+ *
8
+ * This source file is subject to the MIT license that is bundled
9
+ * with this source code in the file LICENSE.
10
+ */
11
+
12
+ namespace FOS \CommentBundle \DependencyInjection \Compiler ;
13
+
14
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
15
+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
16
+
17
+ /**
18
+ * SpamDetectionPass
19
+ */
20
+ class SpamDetectionPass implements CompilerPassInterface
21
+ {
22
+ /**
23
+ * {@inheritDoc}
24
+ */
25
+ public function process (ContainerBuilder $ container )
26
+ {
27
+ // Symfony 2.3 BC
28
+ if (class_exists ('Symfony\Component\HttpFoundation\RequestStack ' )) {
29
+ return ;
30
+ }
31
+
32
+ if ($ container ->hasDefinition ('fos_comment.spam_detection.comment.akismet ' )) {
33
+ $ definition = $ container ->getDefinition ('fos_comment.spam_detection.comment.akismet ' );
34
+ $ definition ->setScope ('request ' );
35
+ }
36
+
37
+ if ($ container ->hasDefinition ('fos_comment.listener.comment_spam ' )) {
38
+ $ definition = $ container ->getDefinition ('fos_comment.listener.comment_spam ' );
39
+ $ definition ->setScope ('request ' );
40
+ }
41
+ }
42
+ }
Original file line number Diff line number Diff line change 13
13
14
14
use FOS \CommentBundle \DependencyInjection \Compiler \SecurityPass ;
15
15
use FOS \CommentBundle \DependencyInjection \Compiler \SortingPass ;
16
+ use FOS \CommentBundle \DependencyInjection \Compiler \SpamDetectionPass ;
16
17
use Symfony \Component \HttpKernel \Bundle \Bundle ;
17
18
use Symfony \Component \DependencyInjection \ContainerBuilder ;
18
19
@@ -30,5 +31,6 @@ public function build(ContainerBuilder $container)
30
31
31
32
$ container ->addCompilerPass (new SecurityPass ());
32
33
$ container ->addCompilerPass (new SortingPass ());
34
+ $ container ->addCompilerPass (new SpamDetectionPass ());
33
35
}
34
36
}
Original file line number Diff line number Diff line change 15
15
16
16
<services >
17
17
18
- <service id =" fos_comment.spam_detection.comment.akismet" class =" FOS\CommentBundle\SpamDetection\AkismetSpamDetection" scope = " request " public =" false" >
18
+ <service id =" fos_comment.spam_detection.comment.akismet" class =" FOS\CommentBundle\SpamDetection\AkismetSpamDetection" public =" false" >
19
19
<argument type =" service" id =" ornicar_akismet" />
20
20
</service >
21
21
22
- <service id =" fos_comment.listener.comment_spam" class =" FOS\CommentBundle\EventListener\CommentSpamListener" scope = " request " >
22
+ <service id =" fos_comment.listener.comment_spam" class =" FOS\CommentBundle\EventListener\CommentSpamListener" >
23
23
<tag name =" kernel.event_subscriber" />
24
24
<argument type =" service" id =" fos_comment.spam_detection.comment" />
25
25
</service >
You can’t perform that action at this time.
0 commit comments