@@ -29,15 +29,7 @@ class AdmingeneratorGeneratorBundle extends Bundle
2929 public function __construct (KernelInterface $ kernel )
3030 {
3131 $ 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 ());
4133 }
4234
4335 /**
@@ -46,8 +38,6 @@ public function boot()
4638 */
4739 public function build (ContainerBuilder $ container )
4840 {
49- $ this ->initAdmingeneratorClassLoader ($ container );
50-
5141 parent ::build ($ container );
5242
5343 $ container ->addCompilerPass (new ValidatorPass ());
@@ -68,16 +58,18 @@ public function getContainerExtension()
6858 /**
6959 * Initialize Admingenerator Class loader
7060 *
71- * @param ContainerBuilder $container
61+ * @param string $cacheDir
7262 */
73- private function initAdmingeneratorClassLoader (ContainerInterface $ container )
63+ private function initAdmingeneratorClassLoader ($ cacheDir )
7464 {
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 ;
8167 }
68+
69+ $ this ->classLoaderInitialized = true ;
70+
71+ $ admingeneratedClassLoader = new AdmingeneratedClassLoader ();
72+ $ admingeneratedClassLoader ->setBasePath ($ cacheDir );
73+ $ admingeneratedClassLoader ->register ();
8274 }
8375}
0 commit comments