Fix default database

parent cdfc2d73
v3.1.4
======
* FEATURE: Ability to configure a custom domain in SASS mode (if the server uses nginx)
* CONFIG: you need to add new entry in your .env.local : DATABASE_NAME=gogocarto_default
v3.0.0
======
......
......@@ -46,7 +46,7 @@ class GoGoAbstractCommand extends Command
if ($input->getArgument('dbname')) {
$this->dm = $this->dmFactory->createForDB($input->getArgument('dbname'));
} else {
$this->dm = $this->dmFactory->createForDB('gogocarto_default');
$this->dm = $this->dmFactory->getDefaultManager();
}
// create dummy user, as some code called from command will maybe need the current user informations
......
......@@ -43,7 +43,7 @@ class ProjectController extends Controller
return $this->redirectToRoute('gogo_homepage');
}
$dm = $dmFactory->createForDB('gogocarto_default');
$dm = $dmFactory->getDefaultManager();
$project = new Project();
$projectForm = $this->createFormBuilder($project)
......@@ -228,7 +228,7 @@ class ProjectController extends Controller
$db = $mongo->selectDB($dbName);
$results = $db->command(['dropDatabase' => 1]);
$rootDm = $dmFactory->createForDB('gogocarto_default');
$rootDm = $dmFactory->getDefaultManager();
$project = $rootDm->getRepository(Project::class)->findOneByDomainName($dbName);
$rootDm->remove($project);
$rootDm->flush();
......
......@@ -39,4 +39,9 @@ class DocumentManagerFactory
$newDm->getConfiguration()->setDefaultDB($databaseName);
return $this->instances[$databaseName] = $newDm;
}
public function getDefaultManager()
{
return $this->defaultDocumentManager;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment