@@ -29,15 +29,7 @@ class AdmingeneratorGeneratorBundle extends Bundle
29
29
public function __construct (KernelInterface $ kernel )
30
30
{
31
31
$ this ->kernel = $ kernel ;
32
- }
33
-
34
- /**
35
- * (non-PHPdoc)
36
- * @see \Symfony\Component\HttpKernel\Bundle\Bundle::boot()
37
- */
38
- public function boot ()
39
- {
40
- $ this ->initAdmingeneratorClassLoader ($ this ->container );
32
+ $ this ->initAdmingeneratorClassLoader ($ kernel ->getCacheDir ());
41
33
}
42
34
43
35
/**
@@ -46,8 +38,6 @@ public function boot()
46
38
*/
47
39
public function build (ContainerBuilder $ container )
48
40
{
49
- $ this ->initAdmingeneratorClassLoader ($ container );
50
-
51
41
parent ::build ($ container );
52
42
53
43
$ container ->addCompilerPass (new ValidatorPass ());
@@ -68,16 +58,18 @@ public function getContainerExtension()
68
58
/**
69
59
* Initialize Admingenerator Class loader
70
60
*
71
- * @param ContainerBuilder $container
61
+ * @param string $cacheDir
72
62
*/
73
- private function initAdmingeneratorClassLoader (ContainerInterface $ container )
63
+ private function initAdmingeneratorClassLoader ($ cacheDir )
74
64
{
75
- if (!$ this ->classLoaderInitialized ) {
76
- $ this ->classLoaderInitialized = true ;
77
-
78
- $ admingeneratedClassLoader = new AdmingeneratedClassLoader ();
79
- $ admingeneratedClassLoader ->setBasePath ($ container ->getParameter ('kernel.cache_dir ' ));
80
- $ admingeneratedClassLoader ->register ();
65
+ if ($ this ->classLoaderInitialized ) {
66
+ return ;
81
67
}
68
+
69
+ $ this ->classLoaderInitialized = true ;
70
+
71
+ $ admingeneratedClassLoader = new AdmingeneratedClassLoader ();
72
+ $ admingeneratedClassLoader ->setBasePath ($ cacheDir );
73
+ $ admingeneratedClassLoader ->register ();
82
74
}
83
75
}
0 commit comments