Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unset parameters for sharded databases as well #896

Merged
merged 2 commits into from Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Command/CreateDatabaseDoctrineCommand.php
Expand Up @@ -63,13 +63,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
$shards = $params['shards'];
// Default select global
$params = array_merge($params, $params['global']);
unset($params['global']['dbname']);
unset($params['global']['dbname'], $params['global']['path'], $params['global']['url']);
if ($input->getOption('shard')) {
foreach ($shards as $i => $shard) {
if ($shard['id'] === (int) $input->getOption('shard')) {
// Select sharded database
$params = array_merge($params, $shard);
unset($params['shards'][$i]['dbname'], $params['id']);
unset($params['shards'][$i]['dbname'], $params['shards'][$i]['path'], $params['shards'][$i]['url'], $params['id']);
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions Tests/Command/CreateDatabaseDoctrineTest.php
Expand Up @@ -51,6 +51,7 @@ public function testExecuteWithShardOption()
'global' => [
'driver' => 'pdo_sqlite',
'dbname' => 'test',
'path' => sys_get_temp_dir() . '/global',
],
'shards' => [
'foo' => [
Expand Down