@@ -169,6 +169,14 @@ public function load(array $configs, ContainerBuilder $container)
169
169
$ definition ->replaceArgument (1 , null );
170
170
}
171
171
172
+ $ this ->addAnnotatedClassesToCompile (array (
173
+ '**Bundle \\Controller \\' ,
174
+ '**Bundle \\Entity \\' ,
175
+
176
+ // Added explicitly so that we don't rely on the class map being dumped to make it work
177
+ 'Symfony \\Bundle \\FrameworkBundle \\Controller \\Controller ' ,
178
+ ));
179
+
172
180
$ this ->addClassesToCompile (array (
173
181
'Symfony \\Component \\Config \\ConfigCache ' ,
174
182
'Symfony \\Component \\Config \\FileLocator ' ,
@@ -906,8 +914,22 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
906
914
$ loader ->load ('annotations.xml ' );
907
915
908
916
if ('none ' !== $ config ['cache ' ]) {
909
- if ('file ' === $ config ['cache ' ]) {
917
+ $ cacheService = $ config ['cache ' ];
918
+
919
+ if ('php_array ' === $ config ['cache ' ]) {
920
+ $ cacheService = 'annotations.cache ' ;
921
+
922
+ // Enable warmer only if PHP array is used for cache
923
+ $ definition = $ container ->findDefinition ('annotations.cache_warmer ' );
924
+ $ definition ->addTag ('kernel.cache_warmer ' );
925
+
926
+ $ this ->addClassesToCompile (array (
927
+ 'Symfony\Component\Cache\Adapter\PhpArrayAdapter ' ,
928
+ 'Symfony\Component\Cache\DoctrineProvider ' ,
929
+ ));
930
+ } elseif ('file ' === $ config ['cache ' ]) {
910
931
$ cacheDir = $ container ->getParameterBag ()->resolveValue ($ config ['file_cache_dir ' ]);
932
+
911
933
if (!is_dir ($ cacheDir ) && false === @mkdir ($ cacheDir , 0777 , true ) && !is_dir ($ cacheDir )) {
912
934
throw new \RuntimeException (sprintf ('Could not create cache directory "%s". ' , $ cacheDir ));
913
935
}
@@ -916,11 +938,13 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
916
938
->getDefinition ('annotations.filesystem_cache ' )
917
939
->replaceArgument (0 , $ cacheDir )
918
940
;
941
+
942
+ $ cacheService = 'annotations.filesystem_cache ' ;
919
943
}
920
944
921
945
$ container
922
946
->getDefinition ('annotations.cached_reader ' )
923
- ->replaceArgument (1 , new Reference (' file ' !== $ config [ ' cache ' ] ? $ config [ ' cache ' ] : ' annotations.filesystem_cache ' ))
947
+ ->replaceArgument (1 , new Reference ($ cacheService ))
924
948
->replaceArgument (2 , $ config ['debug ' ])
925
949
->addAutowiringType (Reader::class)
926
950
;
@@ -1130,10 +1154,8 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
1130
1154
}
1131
1155
1132
1156
$ this ->addClassesToCompile (array (
1133
- 'Psr\Cache\CacheItemInterface ' ,
1134
- 'Psr\Cache\CacheItemPoolInterface ' ,
1135
- 'Symfony\Component\Cache\Adapter\AdapterInterface ' ,
1136
- 'Symfony\Component\Cache\Adapter\AbstractAdapter ' ,
1157
+ 'Symfony\Component\Cache\Adapter\ApcuAdapter ' ,
1158
+ 'Symfony\Component\Cache\Adapter\FilesystemAdapter ' ,
1137
1159
'Symfony\Component\Cache\CacheItem ' ,
1138
1160
));
1139
1161
}
0 commit comments