1 | <?php |
||
32 | class GravitonDocumentBundle extends Bundle implements GravitonBundleInterface |
||
33 | { |
||
34 | /** |
||
35 | * initialize bundle |
||
36 | */ |
||
37 | 18 | public function __construct() |
|
45 | |||
46 | |||
47 | /** |
||
48 | * {@inheritDoc} |
||
49 | * |
||
50 | * @return \Symfony\Component\HttpKernel\Bundle\Bundle[] |
||
|
|||
51 | */ |
||
52 | 18 | public function getBundles() |
|
60 | |||
61 | /** |
||
62 | * load compiler pass |
||
63 | * |
||
64 | * @param ContainerBuilder $container container builder |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | 2 | public function build(ContainerBuilder $container) |
|
69 | { |
||
70 | 2 | parent::build($container); |
|
71 | |||
72 | // If it's inside vendor library or running as graviton base. |
||
73 | 2 | $rootDir = $container->getParameter('kernel.root_dir'); |
|
74 | 2 | if (strpos($rootDir, 'vendor/graviton')) { |
|
75 | $dirs = [ |
||
76 | $rootDir.'/../..' |
||
77 | ]; |
||
78 | } else { |
||
79 | $dirs = [ |
||
80 | 2 | __DIR__ . '/../..', |
|
81 | 2 | $rootDir.'/../vendor/graviton' |
|
82 | ]; |
||
83 | } |
||
84 | |||
85 | 2 | $documentMap = new DocumentMap( |
|
86 | 2 | (new Finder()) |
|
87 | 2 | ->in($dirs) |
|
88 | 2 | ->path('Resources/config/doctrine') |
|
89 | 2 | ->name('*.mongodb.xml'), |
|
90 | 2 | (new Finder()) |
|
91 | 2 | ->in($dirs) |
|
92 | 2 | ->path('Resources/config/serializer') |
|
93 | 2 | ->name('*.xml'), |
|
94 | 2 | (new Finder()) |
|
95 | 2 | ->in($dirs) |
|
96 | 2 | ->path('Resources/config') |
|
97 | 2 | ->name('validation.xml'), |
|
98 | 2 | (new Finder()) |
|
99 | 2 | ->in($dirs) |
|
100 | 2 | ->path('Resources/config/schema') |
|
101 | 2 | ->name('*.json') |
|
102 | ); |
||
103 | |||
104 | 2 | $container->addCompilerPass(new ExtRefMappingCompilerPass()); |
|
105 | 2 | $container->addCompilerPass(new ExtRefFieldsCompilerPass($documentMap)); |
|
106 | 2 | $container->addCompilerPass(new RqlFieldsCompilerPass($documentMap)); |
|
107 | 2 | $container->addCompilerPass(new TranslatableFieldsCompilerPass($documentMap)); |
|
108 | 2 | $container->addCompilerPass(new DocumentFieldNamesCompilerPass($documentMap)); |
|
109 | 2 | $container->addCompilerPass(new ReadOnlyFieldsCompilerPass($documentMap)); |
|
110 | 2 | $container->addCompilerPass(new RecordOriginExceptionFieldsCompilerPass($documentMap)); |
|
111 | 2 | } |
|
112 | |||
113 | /** |
||
114 | * boot bundle function |
||
115 | * |
||
116 | * @return void |
||
117 | */ |
||
118 | 18 | public function boot() |
|
124 | } |
||
125 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.