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 +34
-0
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 14
14
use Symfony \Component \HttpKernel \Bundle \Bundle ;
15
15
use Symfony \Component \DependencyInjection \ContainerBuilder ;
16
16
use Symfony \Cmf \Bundle \MenuBundle \DependencyInjection \Compiler \DecorateMenuFactoryPass ;
17
+ use Symfony \Cmf \Bundle \MenuBundle \DependencyInjection \Compiler \ValidationPass ;
17
18
use Doctrine \Bundle \PHPCRBundle \DependencyInjection \Compiler \DoctrinePhpcrMappingsPass ;
18
19
19
20
class CmfMenuBundle extends Bundle
@@ -23,6 +24,7 @@ public function build(ContainerBuilder $container)
23
24
parent ::build ($ container );
24
25
25
26
$ container ->addCompilerPass (new DecorateMenuFactoryPass ());
27
+ $ container ->addCompilerPass (new ValidationPass ());
26
28
27
29
if (class_exists ('Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass ' )) {
28
30
$ container ->addCompilerPass (
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony CMF package.
5
+ *
6
+ * (c) 2011-2015 Symfony CMF
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 Symfony \Cmf \Bundle \MenuBundle \DependencyInjection \Compiler ;
13
+
14
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
15
+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
16
+
17
+ /**
18
+ * Register validation files only if their persistence layer is enabled.
19
+ *
20
+ * @author Wouter de Jong <[email protected] >
21
+ */
22
+ class ValidationPass implements CompilerPassInterface
23
+ {
24
+ public function process (ContainerBuilder $ container )
25
+ {
26
+ if ($ container ->hasParameter ('cmf_menu.persistence.phpcr.menu_document_class ' )) {
27
+ $ container
28
+ ->getDefinition ('validator.builder ' )
29
+ ->addMethodCall ('addXmlMappings ' , [[__DIR__ .'/../../Resources/config/validation-phpcr.xml ' ]]);
30
+ }
31
+ }
32
+ }
File renamed without changes.
You can’t perform that action at this time.
0 commit comments