コード例 #1
0
ファイル: Module.php プロジェクト: oscar121/doggerout
 /**
  * {@inheritDoc}
  */
 public function init(ModuleManager $e)
 {
     $events = $e->getEventManager()->getSharedManager();
     // Attach to helper set event and load the entity manager helper.
     $events->attach('doctrine', 'loadCli.post', function (EventInterface $e) {
         /* @var $cli \Symfony\Component\Console\Application */
         $cli = $e->getTarget();
         /* @var $sm ServiceLocatorInterface */
         $sm = $e->getParam('ServiceManager');
         $em = $sm->get('doctrine.entitymanager.orm_default');
         $paths = $sm->get('doctrine.configuration.fixtures');
         $importCommand = new ImportCommand();
         $importCommand->setEntityManager($em);
         $importCommand->setPath($paths);
         ConsoleRunner::addCommands($cli);
         $cli->addCommands(array($importCommand));
     });
 }