Fix #12423 Fix bug migration tool when creating fields with brackets in comment

This commit is contained in:
Daniel Gomez Pan
2016-09-11 18:03:09 +02:00
parent 9f71bf400e
commit ae42d7b281
4 changed files with 5 additions and 2 deletions

View File

@ -16,6 +16,7 @@ Yii Framework 2 Change Log
- Enh #10583: Do not silence session errors in debug mode (samdark)
- Enh #12048: Improved message extraction command performance (samdark)
- Enh #12038: Introduced `yii\base\ViewNotFoundException` which is thrown when views file doesn't exists, used it in `ViewAction` (samdark)
- Bug #12423: Fixed bug migration tool when creating fields with brackets in comment
2.0.9 July 11, 2016
-------------------

View File

@ -351,7 +351,7 @@ class MigrateController extends BaseMigrateController
continue;
}
if (!preg_match('/^(.+?)\(([^)]+)\)$/', $chunk)) {
if (!preg_match('/^(.+?)\(([^(]+)\)$/', $chunk)) {
$chunk .= '()';
}
}

View File

@ -20,6 +20,7 @@ class {$class} extends Migration
'title' => \$this->string(10)->notNull()->unique()->defaultValue("test"),
'body' => \$this->text()->notNull(),
'price' => \$this->money(11,2)->notNull(),
'parenthesis_in_comment' => \$this->string(255)->notNull()->comment('Name of set (RU)'),
]);
}

View File

@ -203,7 +203,8 @@ CODE;
$this->assertCommandCreatedFile('create_fields', $migrationName, [
'fields' => 'title:string(10):notNull:unique:defaultValue("test"),
body:text:notNull,
price:money(11,2):notNull'
price:money(11,2):notNull,
parenthesis_in_comment:string(255):notNull:comment(\'Name of set (RU)\')'
]);
$this->assertCommandCreatedFile('create_title_pk', $migrationName, [