From 3b2f3afe2c4755ec2633820d8016f0091bd4cc66 Mon Sep 17 00:00:00 2001 From: mparaiso Date: Sat, 6 Apr 2013 20:27:12 +0200 Subject: [PATCH] cleanup --- .../DoctrineORMServiceProvider~backup.php | 114 ------------------ 1 file changed, 114 deletions(-) delete mode 100644 src/Mparaiso/Provider/DoctrineORMServiceProvider~backup.php diff --git a/src/Mparaiso/Provider/DoctrineORMServiceProvider~backup.php b/src/Mparaiso/Provider/DoctrineORMServiceProvider~backup.php deleted file mode 100644 index d1dd72e..0000000 --- a/src/Mparaiso/Provider/DoctrineORMServiceProvider~backup.php +++ /dev/null @@ -1,114 +0,0 @@ -newDefaultAnnotationDriver($paths, TRUE); - } - return $driver; - } - - public function register(Application $app) - { - $self = $this; - $app["orm.proxy_dir"] = NULL; - $app["orm.cache"] = NULL; - $app["orm.is_dev_mode"] = $app["debug"]; - $app['orm.driver.configs'] = array(); - $app["orm.chain_driver"] = $app->share(function () { - return new MappingDriverChain(); - }); - /** - * EN : create entity manager config - * FR : creer la configuration de l'entity mananger - */ - $app["orm.config"] = $app->share(function ($app) { - $config = Setup::createConfiguration($app["orm.is_dev_mode"], - $app["orm.proxy_dir"], - $app["orm.cache"]); - $config->setMetadataDriverImpl($app["orm.chain_driver"]); - if (isset($app["orm.logger"])) { - $config->setSQLLogger($app["orm.logger"]); - } - $config->addCustomDatetimeFunction("DATE", '\Mparaiso\Doctrine\ORM\Function\Date'); - return $config; - }); - /** - * EN : create the entity manager - * FR : créer l'entity manager - */ - $app["orm.em"] = $app->share(function ($app) use ($self) { - foreach ($app["orm.driver.configs"] as $key => $config) { - if(! is_array($config['paths']))throw new Exception(' $config["paths"] must be an array of paths '); - if ($key == "default") { - $app["orm.chain_driver"]->setDefaultDriver($self->getDriver($config['type'], $config['paths'], $app["orm.config"])); - } - $app["orm.chain_driver"]->addDriver($self->getDriver($config['type'], $config['paths'], $app["orm.config"]), $config["namespace"]); - } - if (!isset($app["orm.connection"]) && $app["db"]) { - $app["orm.connection"] = $app["db"]; - } - $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"]); - } - }); - - } - - -}