Fix #41 #42

Closed
wants to merge 3 commits into
from
View
9 lib/Doctrine/DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -99,8 +99,13 @@ private function buildCodeFromSql(Configuration $configuration, array $sql)
if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
continue;
}
- $code[] = "\$this->addSql(\"$query\");";
+ $codeSql[] = "\$this->addSql(\"$query\");";
@jwage
Doctrine member
jwage added a line comment Oct 28, 2011

Where is $codeSql instantiated?

@beberlei
Doctrine member
beberlei added a line comment Nov 16, 2011

Yes please initialize the $codeSQL Variable and check for count() instead of isset()

@Ocramius
Doctrine member
Ocramius added a line comment Dec 1, 2011

I'd check !empty($codeSQL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ }
+
+ if (isset($codeSql)) {
+ return implode("\n", array_merge($code, $codeSql));
+ } else {
+ return;
}
- return implode("\n", $code);
}
}