Fix #41 #42

Closed
wants to merge 3 commits into from

3 participants

@SongoQ

No description provided.

Marcin Chyłek Fix #41 3d916f7
@stof stof and 1 other commented on an outdated diff Aug 3, 2011
...DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -99,8 +99,14 @@ EOT
if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
continue;
}
- $code[] = "\$this->addSql(\"$query\");";
+ $codeSql[] = "\$this->addSql(\"$query\");";
+ }
+
+ if (isset($codeSql)) {
+ return implode("\n", array_merge($code, $codeSql));
@stof
Doctrine member
stof added a note Aug 3, 2011

the indentation should use 4 spaces

@SongoQ
SongoQ added a note Aug 3, 2011

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@stof stof and 1 other commented on an outdated diff Aug 3, 2011
...DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -99,8 +99,14 @@ EOT
if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
continue;
}
- $code[] = "\$this->addSql(\"$query\");";
+ $codeSql[] = "\$this->addSql(\"$query\");";
+ }
+
+ if (isset($codeSql)) {
+ return implode("\n", array_merge($code, $codeSql));
+ }
+ else {
@stof
Doctrine member
stof added a note Aug 3, 2011

the else should be on the same line than the closing curly brace

@SongoQ
SongoQ added a note Aug 3, 2011

ok, done. Tnx :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Marcin Chyłek added some commits Aug 3, 2011
@jwage
Doctrine member

I prefer this behavior but in your code you changed the variable to $codeSql but don't instantiate that array anywhere.

@jwage jwage commented on the diff Oct 28, 2011
...DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -99,8 +99,13 @@ EOT
if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
continue;
}
- $code[] = "\$this->addSql(\"$query\");";
+ $codeSql[] = "\$this->addSql(\"$query\");";
@jwage
Doctrine member
jwage added a note Oct 28, 2011

Where is $codeSql instantiated?

@beberlei
Doctrine member

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

@Ocramius
Doctrine member
Ocramius added a note 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
@stof
Doctrine member

Fixed in #160

@stof stof closed this Aug 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment