@@ -34,19 +34,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
3434 {
3535 $ io = new SymfonyStyle ($ input , $ output );
3636
37- $ flexModel = $ this ->getContainer ()->get ('flexmodel ' );
37+ $ container = $ this ->getContainer ();
38+
39+ $ flexModel = $ container ->get ('flexmodel ' );
3840 $ domDocument = $ flexModel ->getDOMDocument ();
3941
42+ $ bundleName = $ container ->getParameter ('flex_model.bundle_name ' );
43+ $ bundle = $ this ->getApplication ()->getKernel ()->getBundle ($ bundleName );
44+
4045 $ xslDocument = new DOMDocument ('1.0 ' , 'UTF-8 ' );
4146 $ xslDocument ->load (__DIR__ .'/../Resources/xsl/doctrine-mapping.xsl ' );
4247
4348 $ processor = new XSLTProcessor ();
44- $ processor ->setParameter ('' , 'objectNamespace ' , ' AppBundle \\Entity \\'); // @todo Make configurable
49+ $ processor ->setParameter ('' , 'objectNamespace ' , sprintf ( ' %s \\Entity \\', $ bundle -> getNamespace ()));
4550 $ processor ->importStyleSheet ($ xslDocument );
4651
47- $ bundle = $ this ->getApplication ()->getKernel ()->getBundle ('AppBundle ' ); // @todo Make configurable
48-
49- $ ormMappingDirectory = $ bundle ->getPath ().'/Resources/config/doctrine ' ; // @todo Make configurable
52+ $ ormMappingDirectory = $ bundle ->getPath ().'/Resources/config/doctrine ' ;
5053 if (is_dir (dirname ($ ormMappingDirectory )) === false ) {
5154 mkdir ($ ormMappingDirectory , 0755 , true );
5255 }
@@ -63,6 +66,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
6366 $ io ->success ('Generated Doctrine mapping from FlexModel configuration. ' );
6467
6568 $ command = $ this ->getApplication ()->find ('generate:doctrine:entities ' );
66- $ command ->run (new ArrayInput (array ('name ' => ' AppBundle ' )), $ output );
69+ $ command ->run (new ArrayInput (array ('name ' => $ bundleName )), $ output );
6770 }
6871}
0 commit comments