diff --git a/HttpKernel/ControllerInjectorsWarmer.php b/HttpKernel/ControllerInjectorsWarmer.php
index a5e987b..955cb13 100644
--- a/HttpKernel/ControllerInjectorsWarmer.php
+++ b/HttpKernel/ControllerInjectorsWarmer.php
@@ -28,12 +28,21 @@ class ControllerInjectorsWarmer implements CacheWarmerInterface
private $kernel;
private $controllerResolver;
private $blackListedControllerFiles;
+ private $scanAllBundles;
+ private $scanBundles;
- public function __construct(KernelInterface $kernel, ControllerResolver $resolver, array $blackListedControllerFiles)
- {
+ public function __construct(
+ KernelInterface $kernel,
+ ControllerResolver $resolver,
+ array $blackListedControllerFiles,
+ $scanAllBundles = true,
+ array $scanBundles = array()
+ ) {
$this->kernel = $kernel;
$this->controllerResolver = $resolver;
$this->blackListedControllerFiles = $blackListedControllerFiles;
+ $this->scanAllBundles = $scanAllBundles;
+ $this->scanBundles = $scanBundles;
}
public function warmUp($cacheDir)
@@ -63,6 +72,10 @@ private function findControllerClasses()
{
$dirs = array();
foreach ($this->kernel->getBundles() as $bundle) {
+ if (!$this->scanAllBundles && !in_array($bundle->getName(), $this->scanBundles, true)) {
+ continue;
+ }
+
if (!is_dir($controllerDir = $bundle->getPath().'/Controller')) {
continue;
}
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index 5259eee..d1f5ac5 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -65,6 +65,8 @@
%jms_di_extra.cache_warmer.controller_file_blacklist%
+ %jms_di_extra.all_bundles%
+ %jms_di_extra.bundles%