Skip to content

Commit

Permalink
Merge pull request #62 from linc/fix/config-clues
Browse files Browse the repository at this point in the history
Config validation: Add more clues
  • Loading branch information
linc authored Dec 27, 2024
2 parents bfe318a + 9c426df commit d05b04e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Command/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this
->option('-s --source', 'Name of source package')
->option('-t --target', 'Name of target package')
->option('-i --input', 'Source connection (defined in config)')
->option('-o --output', 'Target connection (defined in config)')
->option('-i --input', 'Source connection alias (defined in config)')
->option('-o --output', 'Target connection alias (defined in config)')
->option('-x --sourceprefix', 'Source prefix')
->option('--cdn', 'CDN prefix')
->option('--dumpsql', 'Output SQL instead of migrating')
Expand Down
5 changes: 5 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public function getConnectionAlias(string $alias): array
*/
protected function validateConnectionInfo(string $alias, array $info): void
{
// Alias not in config.
if (empty($info)) {
trigger_error('Config error: Alias "' . $alias . '" not found', E_USER_ERROR);
}

// Type is required.
if (empty($info['type'])) {
trigger_error('Config error: No connection `type` for alias "' . $alias . '"', E_USER_ERROR);
Expand Down

0 comments on commit d05b04e

Please sign in to comment.