mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-14 21:30:17 +08:00
Merge branch 'master' of git://github.com/yiisoft/yii2 into 9562-add-char-datatype
This commit is contained in:
@@ -8,6 +8,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #10850: Fixed unable to use 'definitions' and 'aliases' at `yii\widgets\MaskedInput` (rahimov, klimov-paul)
|
||||
- Bug #10884: Fixed MessageFormatter for formatting messages when not all parameters are given (laxity7, cebe)
|
||||
- Bug #10946: Fixed parameters binding to the SQL query in `yii\db\mysqlSchema::findConstraints()` (silverfire)
|
||||
- Bug #10969: Fixed generator migration tool with decimal params in column (pana1990)
|
||||
- Bug #10974: `yii.js` - fixed error in ajaxPrefilter event handler, caused by blocked frame (maximal)
|
||||
- Bug: SQlite querybuilder did not create primary key with bigint for `TYPE_BIGPK` (cebe)
|
||||
- Enh #5469: Add mimetype validation by mask in FileValidator (kirsenn, samdark, silverfire)
|
||||
|
||||
@@ -91,7 +91,7 @@ class Controller extends \yii\base\Controller
|
||||
if (in_array($name, $options, true)) {
|
||||
$default = $this->$name;
|
||||
if (is_array($default)) {
|
||||
$this->$name = preg_split('/\s*,\s*/', $value);
|
||||
$this->$name = preg_split('/(?!\(\d+)\s*,\s*(?!\d+\))/', $value);
|
||||
} elseif ($default !== null) {
|
||||
settype($value, gettype($default));
|
||||
$this->$name = $value;
|
||||
|
||||
@@ -493,7 +493,7 @@ class BaseInflector
|
||||
|
||||
return transliterator_transliterate($transliterator, $string);
|
||||
} else {
|
||||
return str_replace(array_keys(static::$transliteration), static::$transliteration, $string);
|
||||
return strtr($string, static::$transliteration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ CODE;
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $migrationName;
|
||||
$this->runMigrateControllerAction('create', [
|
||||
$migrationName,
|
||||
'fields' => 'title:string(10):notNull:unique:defaultValue("test"),body:text:notNull'
|
||||
'fields' => 'title:string(10):notNull:unique:defaultValue("test"),body:text:notNull,price:money(11,2):notNull'
|
||||
]);
|
||||
$file = $this->parseNameClassMigration($class);
|
||||
|
||||
@@ -231,7 +231,8 @@ class {$class} extends Migration
|
||||
\$this->createTable('test', [
|
||||
'id' => \$this->primaryKey(),
|
||||
'title' => \$this->string(10)->notNull()->unique()->defaultValue("test"),
|
||||
'body' => \$this->text()->notNull()
|
||||
'body' => \$this->text()->notNull(),
|
||||
'price' => \$this->money(11,2)->notNull()
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -247,7 +248,7 @@ CODE;
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $migrationName;
|
||||
$this->runMigrateControllerAction('create', [
|
||||
$migrationName,
|
||||
'fields' => 'title:primaryKey,body:text:notNull',
|
||||
'fields' => 'title:primaryKey,body:text:notNull,price:money(11,2)',
|
||||
]);
|
||||
$file = $this->parseNameClassMigration($class);
|
||||
$code = <<<CODE
|
||||
@@ -261,7 +262,8 @@ class {$class} extends Migration
|
||||
{
|
||||
\$this->createTable('test', [
|
||||
'title' => \$this->primaryKey(),
|
||||
'body' => \$this->text()->notNull()
|
||||
'body' => \$this->text()->notNull(),
|
||||
'price' => \$this->money(11,2)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -299,6 +301,38 @@ class {$class} extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
CODE;
|
||||
$this->assertEqualsWithoutLE($code, $file);
|
||||
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $migrationName;
|
||||
$this->runMigrateControllerAction('create', [
|
||||
$migrationName,
|
||||
'fields' => 'id:primaryKey,address:string,address2:string,email:string',
|
||||
]);
|
||||
$file = $this->parseNameClassMigration($class);
|
||||
$code = <<<CODE
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class {$class} extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
\$this->createTable('test', [
|
||||
'id' => \$this->primaryKey(),
|
||||
'address' => \$this->string(),
|
||||
'address2' => \$this->string(),
|
||||
'email' => \$this->string()
|
||||
]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
\$this->dropTable('test');
|
||||
}
|
||||
}
|
||||
|
||||
CODE;
|
||||
$this->assertEqualsWithoutLE($code, $file);
|
||||
}
|
||||
@@ -338,7 +372,7 @@ CODE;
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $migrationName;
|
||||
$this->runMigrateControllerAction('create', [
|
||||
$migrationName,
|
||||
'fields' => 'body:text:notNull'
|
||||
'fields' => 'body:text:notNull,price:money(11,2)'
|
||||
]);
|
||||
$file = $this->parseNameClassMigration($class);
|
||||
$code = <<<CODE
|
||||
@@ -357,37 +391,8 @@ class {$class} extends Migration
|
||||
{
|
||||
\$this->createTable('test', [
|
||||
'id' => \$this->primaryKey(),
|
||||
'body' => \$this->text()->notNull()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
CODE;
|
||||
$this->assertEqualsWithoutLE($code, $file);
|
||||
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $migrationName;
|
||||
$this->runMigrateControllerAction('create', [
|
||||
$migrationName,
|
||||
'fields' => 'title:primaryKey,body:text:notNull'
|
||||
]);
|
||||
$file = $this->parseNameClassMigration($class);
|
||||
$code = <<<CODE
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class {$class} extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
\$this->dropTable('test');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
\$this->createTable('test', [
|
||||
'title' => \$this->primaryKey(),
|
||||
'body' => \$this->text()->notNull()
|
||||
'body' => \$this->text()->notNull(),
|
||||
'price' => \$this->money(11,2)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -402,7 +407,7 @@ CODE;
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $migrationName;
|
||||
$this->runMigrateControllerAction('create', [
|
||||
$migrationName,
|
||||
'fields' => 'title:string(10):notNull,body:text:notNull,created_at:dateTime'
|
||||
'fields' => 'title:string(10):notNull,body:text:notNull,price:money(11,2):notNull,created_at:dateTime'
|
||||
]);
|
||||
$file = $this->parseNameClassMigration($class);
|
||||
|
||||
@@ -417,6 +422,7 @@ class {$class} extends Migration
|
||||
{
|
||||
\$this->addColumn('test', 'title', \$this->string(10)->notNull());
|
||||
\$this->addColumn('test', 'body', \$this->text()->notNull());
|
||||
\$this->addColumn('test', 'price', \$this->money(11,2)->notNull());
|
||||
\$this->addColumn('test', 'created_at', \$this->dateTime());
|
||||
}
|
||||
|
||||
@@ -424,6 +430,7 @@ class {$class} extends Migration
|
||||
{
|
||||
\$this->dropColumn('test', 'title');
|
||||
\$this->dropColumn('test', 'body');
|
||||
\$this->dropColumn('test', 'price');
|
||||
\$this->dropColumn('test', 'created_at');
|
||||
}
|
||||
}
|
||||
@@ -438,39 +445,7 @@ CODE;
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $migrationName;
|
||||
$this->runMigrateControllerAction('create', [
|
||||
$migrationName,
|
||||
'fields' => 'title:string(10):notNull,body:text:notNull,created_at:dateTime'
|
||||
]);
|
||||
$file = $this->parseNameClassMigration($class);
|
||||
|
||||
$code = <<<CODE
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class {$class} extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
\$this->dropColumn('test', 'title');
|
||||
\$this->dropColumn('test', 'body');
|
||||
\$this->dropColumn('test', 'created_at');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
\$this->addColumn('test', 'title', \$this->string(10)->notNull());
|
||||
\$this->addColumn('test', 'body', \$this->text()->notNull());
|
||||
\$this->addColumn('test', 'created_at', \$this->dateTime());
|
||||
}
|
||||
}
|
||||
|
||||
CODE;
|
||||
$this->assertEqualsWithoutLE($code, $file);
|
||||
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $migrationName;
|
||||
$this->runMigrateControllerAction('create', [
|
||||
$migrationName,
|
||||
'fields' => 'title:string(10):notNull,body:text:notNull,created_at:dateTime'
|
||||
'fields' => 'title:string(10):notNull,body:text:notNull,price:money(11,2):notNull,created_at:dateTime'
|
||||
]);
|
||||
$file = $this->parseNameClassMigration($class);
|
||||
|
||||
@@ -485,6 +460,7 @@ class {$class} extends Migration
|
||||
{
|
||||
\$this->dropColumn('test', 'title');
|
||||
\$this->dropColumn('test', 'body');
|
||||
\$this->dropColumn('test', 'price');
|
||||
\$this->dropColumn('test', 'created_at');
|
||||
}
|
||||
|
||||
@@ -492,6 +468,7 @@ class {$class} extends Migration
|
||||
{
|
||||
\$this->addColumn('test', 'title', \$this->string(10)->notNull());
|
||||
\$this->addColumn('test', 'body', \$this->text()->notNull());
|
||||
\$this->addColumn('test', 'price', \$this->money(11,2)->notNull());
|
||||
\$this->addColumn('test', 'created_at', \$this->dateTime());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user