Skip to content

Commit 406e925

Browse files
npmarrinpatrickbrouwers
authored andcommitted
php artisan doctrine:migrations:migrate --write-sql throws ErrorException (#46)
[ErrorException] Invalid argument supplied for foreach() This happens as a result of the return from $sqlWriter->write which returns the result from file_put_contents. file_put_contents returns the number of bytes that were written to the file, or FALSE on failure. writeNotes expects an array of statements which needs to be looked up separately.
1 parent a5926f5 commit 406e925

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Migrator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public function migrateToFile(Migration $migration, $path)
5050
{
5151
$path = is_bool($path) ? getcwd() : $path;
5252

53-
$sql = $migration->getMigration()->writeSqlFile($path, $migration->getVersion());
53+
$sql = $migration->getMigration()->getSql($migration->getVersion());
54+
$migration->getMigration()->writeSqlFile($path, $migration->getVersion());
5455

5556
$this->writeNotes($migration, false, $sql);
5657
}

0 commit comments

Comments
 (0)