From 2170d46cdd2cd4875467c6be671cf4ae7ccd84b8 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 27 May 2015 09:23:21 +0200 Subject: [PATCH] Add fix to use migrations via CLI. --- .../Migrations/AbstractMigrationChamilo.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Chamilo/CoreBundle/Migrations/AbstractMigrationChamilo.php b/src/Chamilo/CoreBundle/Migrations/AbstractMigrationChamilo.php index 0edae0acc5..c0ff710bf0 100644 --- a/src/Chamilo/CoreBundle/Migrations/AbstractMigrationChamilo.php +++ b/src/Chamilo/CoreBundle/Migrations/AbstractMigrationChamilo.php @@ -30,6 +30,24 @@ abstract class AbstractMigrationChamilo extends AbstractMigration */ public function getEntityManager() { + + if (empty($this->manager)) { + $dbParams = array( + 'driver' => 'pdo_mysql', + 'host' => api_get_configuration_value('db_host'), + 'user' => api_get_configuration_value('db_user'), + 'password' => api_get_configuration_value('db_password'), + 'dbname' => api_get_configuration_value('main_database') + ); + $database = new \Database(); + $database->connect( + $dbParams, + __DIR__.'/../../../../', + __DIR__.'/../../../../' + ); + $this->manager = $database->getManager(); + } + return $this->manager; }