This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change 13
13
14
14
use Symfony \Component \HttpKernel \Bundle \Bundle ;
15
15
use Symfony \Component \DependencyInjection \ContainerBuilder ;
16
-
17
- use Symfony \Cmf \Bundle \MenuBundle \DependencyInjection \Compiler \AddVotersPass ;
16
+ use Symfony \Cmf \Bundle \MenuBundle \DependencyInjection \Compiler \DecorateMenuFactoryPass ;
18
17
use Doctrine \Bundle \PHPCRBundle \DependencyInjection \Compiler \DoctrinePhpcrMappingsPass ;
19
18
20
19
class CmfMenuBundle extends Bundle
@@ -23,6 +22,8 @@ public function build(ContainerBuilder $container)
23
22
{
24
23
parent ::build ($ container );
25
24
25
+ $ container ->addCompilerPass (new DecorateMenuFactoryPass ());
26
+
26
27
if (class_exists ('Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass ' )) {
27
28
$ container ->addCompilerPass (
28
29
DoctrinePhpcrMappingsPass::createXmlMappingDriver (
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Cmf \Bundle \MenuBundle \DependencyInjection \Compiler ;
4
+
5
+ use Symfony \Component \DependencyInjection \Alias ;
6
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
7
+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
8
+
9
+ class DecorateMenuFactoryPass implements CompilerPassInterface
10
+ {
11
+ /**
12
+ * {@inheritdoc}
13
+ *
14
+ * @todo Add `decorates="knp_menu.factory"` to the service definition
15
+ * instead if Symfony 2.3 support is dropped.
16
+ */
17
+ public function process (ContainerBuilder $ container )
18
+ {
19
+ if (!$ container ->hasDefinition ('knp_menu.factory ' )) {
20
+ return ;
21
+ }
22
+
23
+ $ knpFactory = $ container ->getDefinition ('knp_menu.factory ' );
24
+ $ knpFactory ->setPublic (false );
25
+
26
+ // rename old service
27
+ $ container ->setDefinition ('cmf_menu.factory.quiet.inner ' , $ knpFactory );
28
+
29
+ $ container ->setAlias ('knp_menu.factory ' , new Alias ('cmf_menu.factory.quiet ' ));
30
+ }
31
+ }
Original file line number Diff line number Diff line change 8
8
9
9
<service id =" cmf_menu.content_router" alias =" router" />
10
10
11
- <service id =" cmf_menu.factory.quiet" class =" Symfony\Cmf\Bundle\MenuBundle\QuietFactory"
12
- decorates =" knp_menu.factory" public =" false" >
11
+ <service id =" cmf_menu.factory.quiet" class =" Symfony\Cmf\Bundle\MenuBundle\QuietFactory" public =" false" >
13
12
<argument type =" service" id =" cmf_menu.factory.quiet.inner" />
14
13
<argument type =" service" id =" logger" />
15
14
<argument >%cmf_menu.allow_empty_items%</argument >
You can’t perform that action at this time.
0 commit comments