Skip to content
This repository

Fix #41 #42

Open
wants to merge 3 commits into from

5 participants

Marcin Chylek Jonathan H. Wage Christophe Coevoet Benjamin Eberlei Marco Pivetta
Marcin Chylek

No description provided.

Marcin Chyłek Fix #41 3d916f7
...DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -99,8 +99,14 @@ EOT
99 99 if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
100 100 continue;
101 101 }
102   - $code[] = "\$this->addSql(\"$query\");";
  102 + $codeSql[] = "\$this->addSql(\"$query\");";
  103 + }
  104 +
  105 + if (isset($codeSql)) {
  106 + return implode("\n", array_merge($code, $codeSql));
2
Christophe Coevoet Collaborator
stof added a note

the indentation should use 4 spaces

Marcin Chylek
SongoQ added a note

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
...DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -99,8 +99,14 @@ EOT
99 99 if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
100 100 continue;
101 101 }
102   - $code[] = "\$this->addSql(\"$query\");";
  102 + $codeSql[] = "\$this->addSql(\"$query\");";
  103 + }
  104 +
  105 + if (isset($codeSql)) {
  106 + return implode("\n", array_merge($code, $codeSql));
  107 + }
  108 + else {
2
Christophe Coevoet Collaborator
stof added a note

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

Marcin Chylek
SongoQ added a note

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
Jonathan H. Wage
Owner

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

Jonathan H. Wage jwage commented on the diff
...DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -99,8 +99,13 @@ EOT
99 99 if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
100 100 continue;
101 101 }
102   - $code[] = "\$this->addSql(\"$query\");";
  102 + $codeSql[] = "\$this->addSql(\"$query\");";
3
Jonathan H. Wage Owner
jwage added a note

Where is $codeSql instantiated?

Benjamin Eberlei Owner

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

I'd check !empty($codeSQL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 3 unique commits by 1 author.

Aug 03, 2011
Marcin Chyłek Fix #41 3d916f7
Marcin Chyłek Add space and else some line 5d3b0dd
Marcin Chyłek Add space and else some line 8e73844
This page is out of date. Refresh to see the latest.
9 lib/Doctrine/DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -99,8 +99,13 @@ private function buildCodeFromSql(Configuration $configuration, array $sql)
99 99 if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
100 100 continue;
101 101 }
102   - $code[] = "\$this->addSql(\"$query\");";
  102 + $codeSql[] = "\$this->addSql(\"$query\");";
  103 + }
  104 +
  105 + if (isset($codeSql)) {
  106 + return implode("\n", array_merge($code, $codeSql));
  107 + } else {
  108 + return;
103 109 }
104   - return implode("\n", $code);
105 110 }
106 111 }

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.