Skip to content

Commit

Permalink
Merge pull request #1439 from wajdijurry/fix-bug-1438
Browse files Browse the repository at this point in the history
Fix Bug #1438
  • Loading branch information
Jeckerson authored Mar 30, 2020
2 parents 1e12d4f + 1ac6f72 commit ffb6537
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions scripts/Phalcon/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,26 @@ public static function generate(array $options)
$optionStack->setDefaultOption('noAutoIncrement', null);
$optionStack->setDefaultOption('verbose', false);

$migrationsDirs = $optionStack->getOption('migrationsDir');
$migrationsDir = $migrationsDirs = $optionStack->getOption('migrationsDir');
//select multiple dir
if (count($migrationsDirs) > 1) {
$question = 'Which migrations path would you like to use?' . PHP_EOL;
foreach ($migrationsDirs as $id => $dir) {
$question .= " [{$id}] $dir" . PHP_EOL;
}
fwrite(STDOUT, Color::info($question));
$handle = fopen("php://stdin", "r");
$line = (int)fgets($handle);
if (!isset($migrationsDirs[$line])) {
echo "ABORTING!\n";
return false;
if (is_array($migrationsDirs)) {
if (count($migrationsDirs) > 1) {
$question = 'Which migrations path would you like to use?' . PHP_EOL;
foreach ($migrationsDirs as $id => $dir) {
$question .= " [{$id}] $dir" . PHP_EOL;
}
fwrite(STDOUT, Color::info($question));
$handle = fopen("php://stdin", "r");
$line = (int)fgets($handle);
if (!isset($migrationsDirs[$line])) {
echo "ABORTING!\n";
return false;
}
fclose($handle);
$migrationsDir = $migrationsDirs[$line];
} else {
$migrationsDir = $migrationsDirs[0];
}
fclose($handle);
$migrationsDir = $migrationsDirs[$line];
} else {
$migrationsDir = $migrationsDirs[0];
}
// Migrations directory
if ($migrationsDir && !file_exists($migrationsDir)) {
Expand Down

0 comments on commit ffb6537

Please sign in to comment.