Permalink
Browse files

$app['orm.console.boot_commands']

  • Loading branch information...
1 parent 3e1263d commit 1c92cb561b85774f5319f7d7ce29dc71268b2ba5 @Mparaiso committed Apr 2, 2013
Showing with 11 additions and 6 deletions.
  1. +11 −6 src/Mparaiso/Provider/DoctrineORMServiceProvider.php
@@ -86,19 +86,24 @@ public function register(Application $app)
}
$em = EntityManager::create($app["orm.connection"], $app["orm.config"]);
+ return $em;
+ });
+
+ $app['orm.manager_registry'] = $app->share(function ($app) {
+ return new DoctrineManagerRegistry(array("default" => $app['orm.em']),
+ array("default" => $app['orm.em']->getConnection()));
+ });
+
+ /* call this to install Doctrine orm's commands $app['orm.console.boot_commands']() */
+ $app['orm.console.boot_commands']=$app->protect(function()use($app){
if (isset($app["console"])) {
+ $em = $app['orm.em'];
/* @var $console \Symfony\Component\Console\Application */
$console = $app["console"];
$console->getHelperSet()->set(new EntityManagerHelper($em), "em");
$console->getHelperSet()->set(new ConnectionHelper($em->getConnection()), "db");
ConsoleRunner::addCommands($app["console"]);
}
- return $em;
- });
-
- $app['orm.manager_registry'] = $app->share(function ($app) {
- return new DoctrineManagerRegistry(array("default" => $app['orm.em']),
- array("default" => $app['orm.em']->getConnection()));
});
}

0 comments on commit 1c92cb5

Please sign in to comment.