@@ -87,24 +87,26 @@ public static function generate(array $options)
87
87
$ optionStack ->setDefaultOption ('noAutoIncrement ' , null );
88
88
$ optionStack ->setDefaultOption ('verbose ' , false );
89
89
90
- $ migrationsDirs = $ optionStack ->getOption ('migrationsDir ' );
90
+ $ migrationsDir = $ migrationsDirs = $ optionStack ->getOption ('migrationsDir ' );
91
91
//select multiple dir
92
- if (count ($ migrationsDirs ) > 1 ) {
93
- $ question = 'Which migrations path would you like to use? ' . PHP_EOL ;
94
- foreach ($ migrationsDirs as $ id => $ dir ) {
95
- $ question .= " [ {$ id }] $ dir " . PHP_EOL ;
96
- }
97
- fwrite (STDOUT , Color::info ($ question ));
98
- $ handle = fopen ("php://stdin " , "r " );
99
- $ line = (int )fgets ($ handle );
100
- if (!isset ($ migrationsDirs [$ line ])) {
101
- echo "ABORTING! \n" ;
102
- return false ;
92
+ if (is_array ($ migrationsDirs )) {
93
+ if (count ($ migrationsDirs ) > 1 ) {
94
+ $ question = 'Which migrations path would you like to use? ' . PHP_EOL ;
95
+ foreach ($ migrationsDirs as $ id => $ dir ) {
96
+ $ question .= " [ {$ id }] $ dir " . PHP_EOL ;
97
+ }
98
+ fwrite (STDOUT , Color::info ($ question ));
99
+ $ handle = fopen ("php://stdin " , "r " );
100
+ $ line = (int )fgets ($ handle );
101
+ if (!isset ($ migrationsDirs [$ line ])) {
102
+ echo "ABORTING! \n" ;
103
+ return false ;
104
+ }
105
+ fclose ($ handle );
106
+ $ migrationsDir = $ migrationsDirs [$ line ];
107
+ } else {
108
+ $ migrationsDir = $ migrationsDirs [0 ];
103
109
}
104
- fclose ($ handle );
105
- $ migrationsDir = $ migrationsDirs [$ line ];
106
- } else {
107
- $ migrationsDir = $ migrationsDirs [0 ];
108
110
}
109
111
// Migrations directory
110
112
if ($ migrationsDir && !file_exists ($ migrationsDir )) {
0 commit comments