Skip to content

Commit

Permalink
Merge pull request #896 from cinamo/master
Browse files Browse the repository at this point in the history
Unset parameters for sharded databases as well
  • Loading branch information
kimhemsoe committed Dec 11, 2018
2 parents 0d045ec + 4b57635 commit 5c13e81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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

0 comments on commit 5c13e81

Please sign in to comment.