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; }