Browse Source

Merge branch 'master' into 2.1

* master: (28 commits)
  test against php 7.1
  use the same db connection for reading and writing data
  added tests classes for db related tests
  refactored database tests
  improved docs about using CORS with REST controllers
  fixed scalar value for IN condition
  guide section about comparing dates
  added errorHandler, Request and Response getter
  fixed tutorial about using yii 1 with yii 2
  note about JOIN syntax
  added note about varying source languages
  Updated language packs zh-CN and ZH-TW
  Fixes #8644: Fixed trying to ENABLE/DISABLE TRIGGER ALL on a view in PostgreSQL
  Fixes #11549: Fixed `ArrayHelper::getValue()` to work properly with float keys
  Unit test for #11549
  Fixes #11739: Fixed `ArrayHelper::index()` losing precision for float keys
  Fix russian translation for Data widgets page (#11776) [skip ci]
  Fixes #11774: Fixed incorrect recusuive symlinks check in FileHelper
  Fixed non-translation block of text (#11765)
  Fixes #10422, #9574: New proposal fix for ColumnSchemaBuilder not null column
  ...

Conflicts:
	framework/web/User.php
tags/3.0.0-alpha1
Carsten Brandt 8 years ago
parent
commit
fcfd54a28c
  1. 5
      .travis.yml
  2. 13
      docs/documentation_style_guide.md
  3. 2
      docs/guide-es/concept-aliases.md
  4. 2
      docs/guide-es/runtime-routing.md
  5. 10
      docs/guide-es/structure-applications.md
  6. 2
      docs/guide-es/structure-controllers.md
  7. 10
      docs/guide-ja/structure-applications.md
  8. 2
      docs/guide-ja/structure-assets.md
  9. 2
      docs/guide-ja/tutorial-i18n.md
  10. 2
      docs/guide-pl/input-validation.md
  11. 2
      docs/guide-pt-BR/caching-http.md
  12. 2
      docs/guide-pt-BR/output-data-providers.md
  13. 10
      docs/guide-pt-BR/structure-applications.md
  14. 2
      docs/guide-ru/concept-aliases.md
  15. 28
      docs/guide-ru/output-data-widgets.md
  16. 2
      docs/guide-ru/runtime-logging.md
  17. 2
      docs/guide-ru/runtime-routing.md
  18. 10
      docs/guide-ru/structure-applications.md
  19. 10
      docs/guide-uk/structure-applications.md
  20. 2
      docs/guide-zh-CN/concept-events.md
  21. 2
      docs/guide-zh-CN/db-dao.md
  22. 4
      docs/guide-zh-CN/rest-response-formatting.md
  23. 10
      docs/guide-zh-CN/structure-applications.md
  24. 2
      docs/guide-zh-CN/structure-assets.md
  25. 2
      docs/guide-zh-CN/structure-views.md
  26. 2
      docs/guide-zh-CN/structure-widgets.md
  27. 35
      docs/guide/rest-controllers.md
  28. 10
      docs/guide/structure-applications.md
  29. 5
      docs/guide/structure-filters.md
  30. 23
      docs/guide/tutorial-core-validators.md
  31. 15
      docs/guide/tutorial-i18n.md
  32. 4
      docs/guide/tutorial-yii-integration.md
  33. 9
      framework/CHANGELOG.md
  34. 2
      framework/assets/yii.js
  35. 8
      framework/base/ErrorException.php
  36. 27
      framework/console/Application.php
  37. 28
      framework/db/ColumnSchemaBuilder.php
  38. 16
      framework/db/Query.php
  39. 9
      framework/db/QueryBuilder.php
  40. 2
      framework/db/pgsql/QueryBuilder.php
  41. 50
      framework/db/pgsql/Schema.php
  42. 6
      framework/filters/Cors.php
  43. 7
      framework/helpers/BaseArrayHelper.php
  44. 5
      framework/helpers/BaseFileHelper.php
  45. 14
      framework/i18n/migrations/m150207_210500_i18n_init.php
  46. 90
      framework/messages/tr/yii.php
  47. 42
      framework/messages/zh-CN/yii.php
  48. 42
      framework/messages/zh-TW/yii.php
  49. 27
      framework/web/Application.php
  50. 2
      framework/web/UploadedFile.php
  51. 2
      tests/framework/data/ActiveDataProviderTest.php
  52. 9
      tests/framework/db/ActiveRecordTest.php
  53. 11
      tests/framework/db/BatchQueryResultTest.php
  54. 16
      tests/framework/db/ColumnSchemaBuilderTest.php
  55. 25
      tests/framework/db/ColumnSchemaTest.php
  56. 6
      tests/framework/db/CommandTest.php
  57. 6
      tests/framework/db/ConnectionTest.php
  58. 11
      tests/framework/db/DatabaseTestCase.php
  59. 1
      tests/framework/db/QueryBuilderTest.php
  60. 6
      tests/framework/db/QueryTest.php
  61. 14
      tests/framework/db/SchemaTest.php
  62. 5
      tests/framework/db/cubrid/ActiveDataProviderTest.php
  63. 6
      tests/framework/db/cubrid/ActiveFixtureTest.php
  64. 5
      tests/framework/db/cubrid/ActiveRecordTest.php
  65. 12
      tests/framework/db/cubrid/BatchQueryResultTest.php
  66. 6
      tests/framework/db/cubrid/ColumnSchemaBuilderTest.php
  67. 5
      tests/framework/db/cubrid/CommandTest.php
  68. 5
      tests/framework/db/cubrid/ConnectionTest.php
  69. 13
      tests/framework/db/cubrid/ExistValidatorTest.php
  70. 3
      tests/framework/db/cubrid/QueryBuilderTest.php
  71. 12
      tests/framework/db/cubrid/QueryTest.php
  72. 4
      tests/framework/db/cubrid/SchemaTest.php
  73. 13
      tests/framework/db/cubrid/UniqueValidatorTest.php
  74. 5
      tests/framework/db/mssql/ActiveDataProviderTest.php
  75. 13
      tests/framework/db/mssql/ActiveFixtureTest.php
  76. 6
      tests/framework/db/mssql/ActiveRecordTest.php
  77. 12
      tests/framework/db/mssql/BatchQueryResultTest.php
  78. 24
      tests/framework/db/mssql/ColumnSchemaBuilderTest.php
  79. 3
      tests/framework/db/mssql/CommandTest.php
  80. 4
      tests/framework/db/mssql/ConnectionTest.php
  81. 13
      tests/framework/db/mssql/ExistValidatorTest.php
  82. 3
      tests/framework/db/mssql/QueryBuilderTest.php
  83. 4
      tests/framework/db/mssql/QueryTest.php
  84. 12
      tests/framework/db/mssql/SchemaTest.php
  85. 13
      tests/framework/db/mssql/UniqueValidatorTest.php
  86. 13
      tests/framework/db/mysql/ActiveDataProviderTest.php
  87. 13
      tests/framework/db/mysql/ActiveFixtureTest.php
  88. 12
      tests/framework/db/mysql/ActiveRecordTest.php
  89. 12
      tests/framework/db/mysql/BatchQueryResultTest.php
  90. 6
      tests/framework/db/mysql/ColumnSchemaBuilderTest.php
  91. 12
      tests/framework/db/mysql/CommandTest.php
  92. 12
      tests/framework/db/mysql/ConnectionTest.php
  93. 13
      tests/framework/db/mysql/ExistValidatorTest.php
  94. 5
      tests/framework/db/mysql/QueryBuilderTest.php
  95. 12
      tests/framework/db/mysql/QueryTest.php
  96. 12
      tests/framework/db/mysql/SchemaTest.php
  97. 13
      tests/framework/db/mysql/UniqueValidatorTest.php
  98. 13
      tests/framework/db/oci/ActiveDataProviderTest.php
  99. 13
      tests/framework/db/oci/ActiveFixtureTest.php
  100. 4
      tests/framework/db/oci/ActiveRecordTest.php
  101. Some files were not shown because too many files have changed in this diff Show More

5
.travis.yml

@ -5,6 +5,11 @@ php:
- 5.6
- 7.0
- hhvm
- nightly
matrix:
allow_failures:
- php: nightly
env:
- CUBRID_VERSION=9.3.0/CUBRID-9.3.0.0206 CUBRID_PDO_VERSION=9.3.0.0001

13
docs/documentation_style_guide.md

@ -51,4 +51,15 @@ containing the translations. The following shows an example for german:
## Capitalizations
* Web, not web
* the guide or this guide, not the Guide
* the guide or this guide, not the Guide
## validating the docs
The following are some scripts that help find broken links and other issues in the guide:
Find broken links (some false-positives may occur):
grep -rniP "\[\[[^\],']+?\][^\]]" docs/guide*
grep -rniP "[^\[]\[[^\]\[,']+?\]\]" docs/guide*

2
docs/guide-es/concept-aliases.md

@ -112,7 +112,7 @@ utilizadas regularmente. La siguiente es la lista de alias predefinidos por Yii:
- `@runtime`: la [[yii\base\Application::runtimePath|ruta de ejecución]] de la aplicación en ejecución. Por defecto `@app/runtime`.
- `@webroot`: el directorio raíz Web de la aplicación Web se está ejecutando actualmente.
- `@web`: la URL base de la aplicación web se ejecuta actualmente. Tiene el mismo valor que [[yii\web\Request::baseUrl]].
- `@vendor`: el [[yii\base\Application::vendorPath|directorio vendor de Composer]. Por defecto `@app/vendor`.
- `@vendor`: el [[yii\base\Application::vendorPath|directorio vendor de Composer]]. Por defecto `@app/vendor`.
- `@bower`, el directorio raíz que contiene [paquetes bower](http://bower.io/). Por defecto `@vendor/bower`.
- `@npm`, el directorio raíz que contiene [paquetes npm](https://www.npmjs.org/). Por defecto `@vendor/npm`.

2
docs/guide-es/runtime-routing.md

@ -152,7 +152,7 @@ echo Url::to(['post/index'], 'https');
Hay que tener en cuenta que en el anterior ejemplo, asumimos que se está usando el formato de URL predeterminado.
Si habilita el formato de URL amigable, las URLs creadas serán diferentes, de acuerdo con las
[[yii\web\UrlManager::rules|URL rules] que se usen.
[[yii\web\UrlManager::rules|URL rules]] que se usen.
La ruta que se pasa al método [[yii\helpers\Url::to()]] es context sensitive. Esto quiere decir que puede ser una ruta
*relativa* o una ruta *absoluta* que serán tipificadas de acuerdo con las siguientes reglas:

10
docs/guide-es/structure-applications.md

@ -215,12 +215,10 @@ para controladores específicos. En el siguiente ejemplo, `account` será mapead
```php
[
'controllerMap' => [
[
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
]

2
docs/guide-es/structure-controllers.md

@ -312,7 +312,7 @@ los usuarios.
* Para [[yii\web\Application|aplicaciones Web]], el valor de retorno pueden ser también datos arbitrarios que serán
asignados a [[yii\web\Response::data]] y más adelante convertidos a una cadena representando el cuerpo de la respuesta.
* Para [[yii\console\Application|aplicaciones de consola], el valor de retorno puede ser también un entero representando
* Para [[yii\console\Application|aplicaciones de consola]], el valor de retorno puede ser también un entero representando
el [[yii\console\Response::exitStatus|status de salida]] de la ejecución del comando.
En los ejemplos mostrados arriba, los resultados de las acciones son todas cadenas que serán tratadas como el cuerpo de la respuesta

10
docs/guide-ja/structure-applications.md

@ -225,12 +225,10 @@ if (YII_ENV_DEV) {
```php
[
'controllerMap' => [
[
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
]

2
docs/guide-ja/structure-assets.md

@ -218,7 +218,7 @@ AppAsset::register($this); // $this はビューオブジェクトを表す
アセットバンドルがビューに登録されるとき、舞台裏では、依存している全てのアセットバンドルが Yii によって登録されます。
そして、アセットバンドルがウェブからはアクセス出来ないディレクトリに配置されている場合は、アセットバンドルがウェブディレクトリに発行されます。
その後、ビューがページをレンダリングするときに、登録されたバンドルのリストに挙げられている CSS と JavaScript ファイルのための `<link>` タグと `<script>` タグが生成されます。
これらのタグの順序は、登録されたバンドル間の依存関係、および、[[yii\web\AssetBundle::css]] と [[yii\web\AssetBundle::js] のプロパティのリストに挙げられたアセットの順序によって決定されます。
これらのタグの順序は、登録されたバンドル間の依存関係、および、[[yii\web\AssetBundle::css]] と [[yii\web\AssetBundle::js]] のプロパティのリストに挙げられたアセットの順序によって決定されます。
### アセットバンドルをカスタマイズする <span id="customizing-asset-bundles"></span>

2
docs/guide-ja/tutorial-i18n.md

@ -683,7 +683,7 @@ class TranslationEventHandler
### `message` コマンドを使う <a name="message-command"></a>
翻訳は [[yii\i18n\PhpMessageSource|php ファイル]]、[[yii\i18n\GettextMessageSource|.po ファイル]、または [[yii\i18n\DbMessageSource|database]] に保存することが出来ます。
翻訳は [[yii\i18n\PhpMessageSource|php ファイル]]、[[yii\i18n\GettextMessageSource|.po ファイル]]、または [[yii\i18n\DbMessageSource|database]] に保存することが出来ます。
追加のオプションについてはそれぞれのクラスを参照してください。
まず最初に、構成情報ファイルを作成する必要があります。

2
docs/guide-pl/input-validation.md

@ -205,7 +205,7 @@ Dla przykładu,
]
```
> Note: Większość walidatorów nie obsługuje pustych pól, jeśli ich właściwość [[yii\validators\Validator::skipOnEmpty|skipOnEmpty] przyjmuje domyślnie wartość `true`.
> Note: Większość walidatorów nie obsługuje pustych pól, jeśli ich właściwość [[yii\validators\Validator::skipOnEmpty|skipOnEmpty]] przyjmuje domyślnie wartość `true`.
> Zostaną one po prostu pominięte podczas walidacji, jeśli ich powiązany atrybut otrzyma wartość uznawaną za pustą.
> Wśród [podstawowych walidatorów](tutorial-core-validators.md), tylko walidatory `captcha`, `default`, `filter`, `required` oraz `trim` obsługują puste pola.

2
docs/guide-pt-BR/caching-http.md

@ -4,7 +4,7 @@ Cache HTTP
Além do cache no servidor que nós descrevemos nas seções anteriores, aplicações Web pode também aproveitar-se
de cache no cliente para economizar o tempo na montagem e transmissão do mesmo conteúdo de uma página.
Para usar o cache no cliente, você poderá configurar [[yii\filters\HttpCache] como um filtro de ações de um controller ao qual o resultado de sua renderização possa ser armazenado em cache no navegador do cliente. A classe [[yii\filters\HttpCache|HttpCache]] funciona apenas para requisições `GET` e `HEAD`. Ele pode manipular três tipos de cache relacionados a cabeçalhos HTTP para estas requisições:
Para usar o cache no cliente, você poderá configurar [[yii\filters\HttpCache]] como um filtro de ações de um controller ao qual o resultado de sua renderização possa ser armazenado em cache no navegador do cliente. A classe [[yii\filters\HttpCache|HttpCache]] funciona apenas para requisições `GET` e `HEAD`. Ele pode manipular três tipos de cache relacionados a cabeçalhos HTTP para estas requisições:
* [[yii\filters\HttpCache::lastModified|Last-Modified]]
* [[yii\filters\HttpCache::etagSeed|Etag]]

2
docs/guide-pt-BR/output-data-providers.md

@ -90,7 +90,7 @@ Por padrão, [[yii\data\ActiveDataProvider]] utiliza o componente da aplicação
O [[yii\data\SqlDataProvider]] trabalha com uma instrução SQL, que é usado para obter os dados necessários. Com base nas especificações de [[yii\data\SqlDataProvider::sort|sort]] e
[[yii\data\SqlDataProvider::pagination|pagination]], o provider ajustará as cláusulas `ORDER BY` e `LIMIT` da instrução SQL em conformidade para buscar somente a página de dados solicitada na ordem desejada.
Para usar [[yii\data\SqlDataProvider]], você deve especificar a propriedade [[yii\data\SqlDataProvider::sql|sql]] bem como a propriedade [[yii\data\SqlDataProvider::totalCount|totalCount]. Por exemplo:
Para usar [[yii\data\SqlDataProvider]], você deve especificar a propriedade [[yii\data\SqlDataProvider::sql|sql]] bem como a propriedade [[yii\data\SqlDataProvider::totalCount|totalCount]]. Por exemplo:
```php
use yii\data\SqlDataProvider;

10
docs/guide-pt-BR/structure-applications.md

@ -253,12 +253,10 @@ enquanto `article` será mapeado para `app\controllers\PostController`.
```php
[
'controllerMap' => [
[
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
]

2
docs/guide-ru/concept-aliases.md

@ -105,7 +105,7 @@ $cache = new FileCache([
- `@yii`: директория, в которой находится файл `BaseYii.php` (директория фреймворка).
- `@app`: [[yii\base\Application::basePath|базовый путь]] текущего приложения.
- `@runtime`: [[yii\base\Application::runtimePath|директория runtime]] текущего приложения.
- `@vendor`: [[yii\base\Application::vendorPath|директория vendor Composer].
- `@vendor`: [[yii\base\Application::vendorPath|директория vendor Composer]].
- `@webroot`: вебрут текущего веб приложения (там где находится [входной скрипт](structure-entry-scripts.md) `index.php`).
- `@web`: базовый URL текущего приложения.

28
docs/guide-ru/output-data-widgets.md

@ -145,15 +145,15 @@ echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// Simple columns defined by the data contained in $dataProvider.
// Data from the model's column will be used.
// Обычные поля определенные данными содержащимися в $dataProvider.
// Будут использованы данные из полей модели.
'id',
'username',
// More complex one.
// Более сложный пример.
[
'class' => 'yii\grid\DataColumn', // can be omitted, as it is the default
'class' => 'yii\grid\DataColumn', // может быть опущено, поскольку является значением по умолчанию
'value' => function ($data) {
return $data->name; // $data['name'] for array data, e.g. using SqlDataProvider.
return $data->name; // $data['name'] для массивов, например, при использовании SqlDataProvider.
},
],
],
@ -360,7 +360,7 @@ class PostSearch extends Post
{
public function rules()
{
// only fields in rules() are searchable
// только поля определенные в rules() будут доступны для поиска
return [
[['id'], 'integer'],
[['title', 'creation_date'], 'safe'],
@ -381,12 +381,12 @@ class PostSearch extends Post
'query' => $query,
]);
// load the search form data and validate
// загружаем данные формы поиска и производим валидацию
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
// adjust the query by adding the filters
// изменяем запрос добавляя в его фильтрацию
$query->andFilterWhere(['id' => $this->id]);
$query->andFilterWhere(['like', 'title', $this->title])
->andFilterWhere(['like', 'creation_date', $this->creation_date]);
@ -519,10 +519,10 @@ $dataProvider = new ActiveDataProvider([
'query' => $query,
]);
// join with relation `author` that is a relation to the table `users`
// and set the table alias to be `author`
// присоединяем зависимость `author` которая является связью с таблицей `users`
// и устанавливаем алиас таблицы в значение `author`
$query->joinWith(['author' => function($query) { $query->from(['author' => 'users']); }]);
// enable sorting for the related column
// добавляем сортировку по колонке из зависимости
$dataProvider->sort->attributes['author.name'] = [
'asc' => ['author.name' => SORT_ASC],
'desc' => ['author.name' => SORT_DESC],
@ -537,7 +537,7 @@ $dataProvider->sort->attributes['author.name'] = [
```php
public function attributes()
{
// add related fields to searchable attributes
// делаем поле зависимости доступным для поиска
return array_merge(parent::attributes(), ['author.name']);
}
@ -635,7 +635,7 @@ class UserView extends ActiveRecord
public function rules()
{
return [
// define here your rules
// здесь определяйте ваши правила
];
}
@ -645,7 +645,7 @@ class UserView extends ActiveRecord
public static function attributeLabels()
{
return [
// define here your attribute labels
// здесь определяйте ваши метки атрибутов
];
}

2
docs/guide-ru/runtime-logging.md

@ -132,7 +132,7 @@ return [
### Форматирование сообщений <span id="message-formatting"></span>
Цели логов выгружают отфильтрованные сообщения в определенном формате. Например, цель классна [[yii\log\FileTarget]] сохранит сообщение следующего формата в файле `runtime/log/app.log`:
Цели логов выгружают отфильтрованные сообщения в определенном формате. Например, цель класса [[yii\log\FileTarget]] сохранит сообщение следующего формата в файле `runtime/log/app.log`:
```
2014-10-04 18:10:15 [::1][][-][trace][yii\base\Module::getModule] Loading module: debug

2
docs/guide-ru/runtime-routing.md

@ -369,7 +369,7 @@ echo Url::previous();
> Note: При настроенном суффиксе, все URL не содержащие этот суффикс будут расценены как неизвестные URL. Такое поведение рекомендовано для SEO (поисковая оптимизация).
Иногда возникает необходимость использовать разные суффиксы для разных URL. Добиться этого можно настройкой свойства [[yii\web\UrlRule::suffix|suffix]] у каждого правила. Когда это свойство установлено, оно имеет приоритет перед общей конфигурацией компонента [[yii\web\UrlManager|URL manager]]. Например, Следующая конфигурация содержит правило URL, `.json` as its suffix instead of the global one `.html`.
Иногда возникает необходимость использовать разные суффиксы для разных URL. Добиться этого можно настройкой свойства [[yii\web\UrlRule::suffix|suffix]] у каждого правила. Когда это свойство установлено, оно имеет приоритет перед общей конфигурацией компонента [[yii\web\UrlManager|URL manager]]. Например, cледующая конфигурация содержит правило URL, которое использует `.json` в качестве суффикса вместо глобального `.html`.
```php
[

10
docs/guide-ru/structure-applications.md

@ -228,12 +228,10 @@ if (YII_ENV_DEV) {
```php
[
'controllerMap' => [
[
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
]

10
docs/guide-uk/structure-applications.md

@ -232,12 +232,10 @@ Yii встановлює відповідність між ідентифіка
```php
[
'controllerMap' => [
[
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
]

2
docs/guide-zh-CN/concept-events.md

@ -68,7 +68,7 @@ $foo->on(Foo::EVENT_HELLO, function ($event) {
事件处理器顺序
-----------------
可以附加一个或多个处理器到一个事件。当事件被触发,已附加的处理器将按附加次序依次调用。如果某个处理器需要停止其后的处理器调用,可以设置 `$event` 参数的 [yii\base\Event::handled]] 属性为真,如下:
可以附加一个或多个处理器到一个事件。当事件被触发,已附加的处理器将按附加次序依次调用。如果某个处理器需要停止其后的处理器调用,可以设置 `$event` 参数的 [[yii\base\Event::handled]] 属性为真,如下:
```php
$foo->on(Foo::EVENT_HELLO, function ($event) {

2
docs/guide-zh-CN/db-dao.md

@ -349,7 +349,7 @@ $db->createCommand("UPDATE user SET username='demo' WHERE id=1")->execute();
```
> Note: 通过[[yii\db\Command::execute()]] 执行的查询被认为是写操作,所有使用[[yii\db\Command]]来执行的其他查询方法被认为是读操作.你可以通过`$db->slave`得到当前正在使用能够的从服务器.
`Connection`组件支持从服务器的负载均衡和故障转移,当第一次执行读查询时,会随即选择一个从服务器进行连接,如果连接失败则又选择另一个,如果所有从服务器都不可用,则会连接主服务器。你可以配置[[yii\db\Connection::serverStatusCache|server status cache]]来记住那些不能连接的从服务器,使Yii 在一段时间[[yii\db\Connection::serverRetryInterval].内不会重复尝试连接那些根本不可用的从服务器.
`Connection`组件支持从服务器的负载均衡和故障转移,当第一次执行读查询时,会随即选择一个从服务器进行连接,如果连接失败则又选择另一个,如果所有从服务器都不可用,则会连接主服务器。你可以配置[[yii\db\Connection::serverStatusCache|server status cache]]来记住那些不能连接的从服务器,使Yii 在一段时间[[yii\db\Connection::serverRetryInterval]].内不会重复尝试连接那些根本不可用的从服务器.
> Note: 在上述配置中,每个从服务器连接超时时间被指定为10s. 如果在10s内不能连接,则被认为该服务器已经挂掉.你也可以自定义超时参数.

4
docs/guide-zh-CN/rest-response-formatting.md

@ -9,8 +9,8 @@
2. 资源对象转换为数组, 如在 [Resources](rest-resources.md) 部分中所描述的。
通过 [[yii\rest\Serializer]] 来完成。
3. 通过内容协商步骤将数组转换成字符串。
[yii\web\ResponseFormatterInterface|response formatters]] 通过
[yii\web\Response::formatters|response]] 应用程序组件来注册完成。
[[yii\web\ResponseFormatterInterface|response formatters]] 通过
[[yii\web\Response::formatters|response]] 应用程序组件来注册完成。
## 内容协商 <span id="content-negotiation"></span>

10
docs/guide-zh-CN/structure-applications.md

@ -198,12 +198,10 @@ if (YII_ENV_DEV) {
```php
[
'controllerMap' => [
[
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
]

2
docs/guide-zh-CN/structure-assets.md

@ -188,7 +188,7 @@ AppAsset::register($this); // $this 代表视图对象
### 自定义资源包 <span id="customizing-asset-bundles"></span>
Yii通过名为 `assetManager`的应用组件实现[[yii\web\AssetManager] 来管理应用组件,
Yii通过名为 `assetManager`的应用组件实现[[yii\web\AssetManager]] 来管理应用组件,
通过配置[[yii\web\AssetManager::bundles]] 属性,可以自定义资源包的行为,
例如,[[yii\web\JqueryAsset]] 资源包默认从jquery Bower包中使用`jquery.js` 文件,
为了提高可用性和性能,你可能需要从Google服务器上获取jquery文件,可以在应用配置中配置`assetManager`,如下所示:

2
docs/guide-zh-CN/structure-views.md

@ -390,7 +390,7 @@ class PostController extends Controller
第二步,它决定第一步中布局的值和上下文模块对应到实际的布局文件,布局的值可为:
- 路径别名 (如 `@app/views/layouts/main`).
- 绝对路径 (如 `/main`): 布局的值以斜杠开始,在应用的[[yii\base\Application::layoutPath|layout path] 布局路径
- 绝对路径 (如 `/main`): 布局的值以斜杠开始,在应用的[[yii\base\Application::layoutPath|layout path]] 布局路径
中查找实际的布局文件,布局路径默认为 `@app/views/layouts`
- 相对路径 (如 `main`): 在上下文模块的[[yii\base\Module::layoutPath|layout path]]布局路径中查找实际的布局文件,
布局路径默认为[[yii\base\Module::basePath|module directory]]模块目录下的`views/layouts` 目录。

2
docs/guide-zh-CN/structure-widgets.md

@ -12,7 +12,7 @@ use yii\jui\DatePicker;
<?= DatePicker::widget(['name' => 'date']) ?>
```
Yii提供许多优秀的小部件,比如[[yii\widgets\ActiveForm|active form]], [yii\widgets\Menu|menu]],
Yii提供许多优秀的小部件,比如[[yii\widgets\ActiveForm|active form]], [[yii\widgets\Menu|menu]],
[jQuery UI widgets](widget-jui.md), [Twitter Bootstrap widgets](widget-bootstrap.md)。
接下来介绍小部件的基本知识,如果你想了解某个小部件请参考对应的类API文档。

35
docs/guide/rest-controllers.md

@ -75,6 +75,41 @@ public function behaviors()
}
```
### CORS <span id="cors"></span>
Adding the [Cross Origin Resource Sharing](structure-filters.md#cors) filter to a controller is a bit more complicated
than adding other filters described above, because the CORS filter has to be applied before authentication methods
and thus needs a slightly different approach compared to other filters. Also authentication has to be disabled for the
[CORS Preflight requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests)
so that a browser can safely determine whether a request can be made beforehand without the need for sending
authentication credentials. The follow code shows the code that is needed to add the [[yii\filters\Cors]] filter
to an existing controller that extends from [[yii\rest\ActiveController]]:
```php
use yii\filters\auth\HttpBasicAuth;
public function behaviors()
{
$behaviors = parent::behaviors();
// remove authentication filter
$auth = $behaviors['authenticator'];
unset($behaviors['authenticator']);
// add CORS filter
$behaviors['corsFilter'] = [
'class' => \yii\filters\Cors::className(),
];
// re-add authentication filter
$behaviors['authenticator'] = $auth;
// avoid authentication on CORS-pre-flight requests (HTTP OPTIONS method)
$behaviors['authenticator']['except'] = ['options'];
return $behaviors;
}
```
## Extending `ActiveController` <span id="extending-active-controller"></span>

10
docs/guide/structure-applications.md

@ -233,12 +233,10 @@ specific controllers. In the following example, `account` will be mapped to
```php
[
'controllerMap' => [
[
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
]

5
docs/guide/structure-filters.md

@ -345,7 +345,10 @@ public function behaviors()
}
```
The Cors filtering could be tuned using the `cors` property.
Also check the section on [REST Controllers](rest-controllers.md#cors) if you want to add the CORS filter to an
[[yii\rest\ActiveController]] class in your API.
The Cors filtering could be tuned using the [[yii\filters\Cors::$cors|$cors]] property.
* `cors['Origin']`: array used to define allowed origins. Can be `['*']` (everyone) or `['http://www.myserver.net', 'http://www.myotherserver.com']`. Default to `['*']`.
* `cors['Access-Control-Request-Method']`: array of allowed verbs like `['GET', 'OPTIONS', 'HEAD']`. Default to `['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS']`.

23
docs/guide/tutorial-core-validators.md

@ -93,6 +93,29 @@ is as specified by the `operator` property.
* `<=`: check if value being validated is less than or equal to the value being compared with.
### Comparing date values
The compare validator can only be used to compare strings and numbers. If you need to compare values
like dates you have two options. For comparing a date against a fixed value, you can simply use the
[[yii\validators\DateValidator|date]] validator and specify its
[[yii\validators\DateValidator::$min|$min]] or [[yii\validators\DateValidator::$max|$max]] property.
If you need to compare two dates entered in the form, e.g. a `fromDate` and a `toDate` field,
you can use a combination of compare and date validator like the following:
```php
['fromDate', 'date', 'timestampAttribute' => 'fromDate'],
['toDate', 'date', 'timestampAttribute' => 'toDate'],
['fromDate', 'compare', 'compareAttribute' => 'toDate', 'operator' => '<', 'enableClientValidation' => false],
```
As validators are executed in the order they are specified this will first validate that the values entered in
`fromDate` and `toDate` are valid date values and if so, they will be converted into a machine readable format.
Afterwards these two values are compared with the compare validator.
Client validation is not enabled as this will only work on the server side because the date validator currently does not
provide client validation, so [[yii\validators\CompareValidator::$enableClientValidation|$enableClientValidation]]
is set to `false` on the compare validator too.
## [[yii\validators\DateValidator|date]] <span id="date"></span>
```php

15
docs/guide/tutorial-i18n.md

@ -9,14 +9,14 @@ translation, view translation, date and number formatting.
## Locale and Language <span id="locale-language"></span>
Locale is a set of parameters that defines the user's language, country and any special variant preferences
that the user wants to see in their user interface. It is usually identified by an ID consisting of a language
ID and a region ID. For example, the ID `en-US` stands for the locale of English and United States.
For consistency, all locale IDs used in Yii applications should be canonicalized to the format of
Locale is a set of parameters that defines the user's language, country and any special variant preferences
that the user wants to see in their user interface. It is usually identified by an ID consisting of a language
ID and a region ID. For example, the ID `en-US` stands for the locale of English and United States.
For consistency, all locale IDs used in Yii applications should be canonicalized to the format of
`ll-CC`, where `ll` is a two- or three-letter lowercase language code according to
[ISO-639](http://www.loc.gov/standards/iso639-2/) and `CC` is a two-letter country code according to
[ISO-3166](http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html).
More details about locale can be found in the
More details about locale can be found in the
[documentation of the ICU project](http://userguide.icu-project.org/locale#TOC-The-Locale-Concept).
In Yii, we often use the term "language" to refer to a locale.
@ -53,6 +53,9 @@ you can use the following statement to change the target language:
\Yii::$app->language = 'zh-CN';
```
> Tip: If your source language varies among different parts of your code, you can
> override the source language for different message sources, which are described in the next section.
## Message Translation <span id="message-translation"></span>
The message translation service translates a text message from one language (usually the [[yii\base\Application::$sourceLanguage|source language]])
@ -631,7 +634,7 @@ If [[yii\i18n\MissingTranslationEvent::translatedMessage]] is set by the event h
### Using the `message` command <a name="message-command"></a>
Translations can be stored in [[yii\i18n\PhpMessageSource|php files]], [[yii\i18n\GettextMessageSource|.po files] or to [[yii\i18n\DbMessageSource|database]]. See specific classes for additional options.
Translations can be stored in [[yii\i18n\PhpMessageSource|php files]], [[yii\i18n\GettextMessageSource|.po files]] or in a [[yii\i18n\DbMessageSource|database]]. See specific classes for additional options.
First of all you need to create a configuration file. Decide where you want to store it and then issue the command

4
docs/guide/tutorial-yii-integration.md

@ -153,7 +153,7 @@ require(__DIR__ . '/../components/Yii.php');
// configuration for Yii 2 application
$yii2Config = require(__DIR__ . '/../config/yii2/web.php');
new yii\web\Application($yii2Config); // Do NOT call run()
new yii\web\Application($yii2Config); // Do NOT call run(), yii2 app is only used as service locator
// configuration for Yii 1 application
$yii1Config = require(__DIR__ . '/../config/yii1/main.php');
@ -177,7 +177,7 @@ class Yii extends \yii\BaseYii
Yii::$classMap = include($yii2path . '/classes.php');
// register Yii 2 autoloader via Yii 1
Yii::registerAutoloader(['Yii', 'autoload']);
Yii::registerAutoloader(['yii\BaseYii', 'autoload']);
// create the dependency injection container
Yii::$container = new yii\di\Container;
```

9
framework/CHANGELOG.md

@ -13,6 +13,7 @@ Yii Framework 2 Change Log
2.0.9 under development
-----------------------
- Enh #10422: Added `null` method on `yii\db\ColumnSchemaBuilder` to explicitly set column nullability (nevermnd)
- Enh #8795: Refactored `yii\web\User::loginByCookie()` in order to make it easier to override (maine-mike, silverfire)
- Enh #9948: `yii\rbac\PhpManager` now invalidates script file cache performed by 'OPCache' or 'APC' on file saving (klimov-paul)
- Enh #11195: Added ability to append custom string to schema builder column definition (df2, samdark)
@ -35,7 +36,13 @@ Yii Framework 2 Change Log
- Bug #11527: Fixed `bigPrimaryKey()` for SQLite (dynasource)
- Bug #11686: `BaseArrayHelper::isIn()` comparison did not work in strict mode (taobig)
- Enh #11679: Extracted `CheckAccessInterface` from `ManagerInterface` (SamMousa, samdark, mdomba)
- Bug #11723: Fixed PHP 7 + XDebug error handling displaying "Expected array for frame 0" (tanakahisateru)
- Bug #11735: Fixed `yii\web\UploadedFile` to return `null` when there's no file uploaded (brummm)
- Bug #11774: Fixed incorrect recusuive symlinks check in FileHelper (AnikanovD)
- Bug #11739: Fixed `ArrayHelper::index()` losing precision for float keys (AnikanovD)
- Bug #11549: Fixed `ArrayHelper::getValue()` to work properly with float keys (zsounder, AnikanovD)
- Bug #8644: Fixed trying to ENABLE/DISABLE TRIGGER ALL on a view in PostgreSQL (ricpelo)
- Bug #11536: Fixed regression introduced in 2.0.8, where scalar value was not allowed in QueryBuilder `IN` condition anymore (cebe)
2.0.8 April 28, 2016
--------------------

2
framework/assets/yii.js

@ -411,7 +411,7 @@ yii = (function ($) {
return pub;
})(jQuery);
jQuery(document).ready(function () {
jQuery(function () {
yii.initModule(yii);
});

8
framework/base/ErrorException.php

@ -43,8 +43,11 @@ class ErrorException extends \ErrorException
parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
if (function_exists('xdebug_get_function_stack')) {
$trace = array_slice(array_reverse(xdebug_get_function_stack()), 3, -1);
foreach ($trace as &$frame) {
// XDebug trace can't be modified and used directly with PHP 7
// @see https://github.com/yiisoft/yii2/pull/11723
$xDebugTrace = array_slice(array_reverse(xdebug_get_function_stack()), 3, -1);
$trace = [];
foreach ($xDebugTrace as $frame) {
if (!isset($frame['function'])) {
$frame['function'] = 'unknown';
}
@ -60,6 +63,7 @@ class ErrorException extends \ErrorException
if (isset($frame['params']) && !isset($frame['args'])) {
$frame['args'] = $frame['params'];
}
$trace[] = $frame;
}
$ref = new \ReflectionProperty('Exception', 'trace');

27
framework/console/Application.php

@ -198,6 +198,33 @@ class Application extends \yii\base\Application
}
/**
* Returns the error handler component.
* @return ErrorHandler the error handler application component.
*/
public function getErrorHandler()
{
return $this->get('errorHandler');
}
/**
* Returns the request component.
* @return Request the request component.
*/
public function getRequest()
{
return $this->get('request');
}
/**
* Returns the response component.
* @return Response the response component.
*/
public function getResponse()
{
return $this->get('response');
}
/**
* @inheritdoc
*/
public function coreComponents()

28
framework/db/ColumnSchemaBuilder.php

@ -40,9 +40,10 @@ class ColumnSchemaBuilder extends Object
*/
protected $length;
/**
* @var boolean whether the column is not nullable. If this is `true`, a `NOT NULL` constraint will be added.
* @var boolean|null whether the column is or not nullable. If this is `true`, a `NOT NULL` constraint will be added.
* If this is `false`, a `NULL` constraint will be added.
*/
protected $isNotNull = false;
protected $isNotNull = null;
/**
* @var boolean whether the column values should be unique. If this is `true`, a `UNIQUE` constraint will be added.
*/
@ -76,7 +77,6 @@ class ColumnSchemaBuilder extends Object
*/
protected $isFirst;
/**
* @var array mapping of abstract column types (keys) to type categories (values).
* @since 2.0.8
@ -142,6 +142,17 @@ class ColumnSchemaBuilder extends Object
}
/**
* Adds a `NULL` constraint to the column
* @return $this
* @since 2.0.9
*/
public function null()
{
$this->isNotNull = false;
return $this;
}
/**
* Adds a `UNIQUE` constraint to the column.
* @return $this
*/
@ -286,11 +297,18 @@ class ColumnSchemaBuilder extends Object
/**
* Builds the not null constraint for the column.
* @return string returns 'NOT NULL' if [[isNotNull]] is true, otherwise it returns an empty string.
* @return string returns 'NOT NULL' if [[isNotNull]] is true,
* 'NULL' if [[isNotNull]] is false or an empty string otherwise.
*/
protected function buildNotNullString()
{
return $this->isNotNull ? ' NOT NULL' : '';
if ($this->isNotNull === true) {
return ' NOT NULL';
} elseif ($this->isNotNull === false) {
return ' NULL';
} else {
return '';
}
}
/**

16
framework/db/Query.php

@ -635,6 +635,16 @@ class Query extends Component implements QueryInterface
*
* @param string|array $on the join condition that should appear in the ON part.
* Please refer to [[where()]] on how to specify this parameter.
*
* Note that the array format of [[where()]] is designed to match columns to values instead of columns to columns, so
* the following would **not** work as expected: `['post.author_id' => 'user.id']`, it would
* match the `post.author_id` column value against the string `'user.id'`.
* It is recommended to use the string syntax here which is more suited for a join:
*
* ```php
* 'post.author_id = user.id'
* ```
*
* @param array $params the parameters (name => value) to be bound to the query.
* @return $this the query object itself
*/
@ -658,7 +668,7 @@ class Query extends Component implements QueryInterface
* represents the alias for the sub-query.
*
* @param string|array $on the join condition that should appear in the ON part.
* Please refer to [[where()]] on how to specify this parameter.
* Please refer to [[join()]] on how to specify this parameter.
* @param array $params the parameters (name => value) to be bound to the query.
* @return $this the query object itself
*/
@ -682,7 +692,7 @@ class Query extends Component implements QueryInterface
* represents the alias for the sub-query.
*
* @param string|array $on the join condition that should appear in the ON part.
* Please refer to [[where()]] on how to specify this parameter.
* Please refer to [[join()]] on how to specify this parameter.
* @param array $params the parameters (name => value) to be bound to the query
* @return $this the query object itself
*/
@ -706,7 +716,7 @@ class Query extends Component implements QueryInterface
* represents the alias for the sub-query.
*
* @param string|array $on the join condition that should appear in the ON part.
* Please refer to [[where()]] on how to specify this parameter.
* Please refer to [[join()]] on how to specify this parameter.
* @param array $params the parameters (name => value) to be bound to the query
* @return $this the query object itself
*/

9
framework/db/QueryBuilder.php

@ -1157,18 +1157,21 @@ class QueryBuilder extends \yii\base\Object
list($column, $values) = $operands;
if ($column === []) {
// no columns to test against
return $operator === 'IN' ? '0=1' : '';
}
if ($values instanceof Query) {
return $this->buildSubqueryInCondition($operator, $column, $values, $params);
}
if (!is_array($values) && !$values instanceof \Traversable) {
// ensure values is an array
$values = (array) $values;
}
if ($column instanceof \Traversable || count($column) > 1) {
return $this->buildCompositeInCondition($operator, $column, $values, $params);
}
if (is_array($column)) {
} elseif (is_array($column)) {
$column = reset($column);
}

2
framework/db/pgsql/QueryBuilder.php

@ -190,6 +190,8 @@ class QueryBuilder extends \yii\db\QueryBuilder
$enable = $check ? 'ENABLE' : 'DISABLE';
$schema = $schema ? $schema : $this->db->getSchema()->defaultSchema;
$tableNames = $table ? [$table] : $this->db->getSchema()->getTableNames($schema);
$viewNames = $this->db->getSchema()->getViewNames($schema);
$tableNames = array_diff($tableNames, $viewNames);
$command = '';
foreach ($tableNames as $tableName) {

50
framework/db/pgsql/Schema.php

@ -107,6 +107,10 @@ class Schema extends \yii\db\Schema
'jsonb' => self::TYPE_STRING,
'xml' => self::TYPE_STRING,
];
/**
* @var array list of ALL view names in the database
*/
private $_viewNames = [];
/**
@ -213,6 +217,52 @@ SQL;
}
/**
* Returns all views names in the database.
* @param string $schema the schema of the views. Defaults to empty string, meaning the current or default schema.
* @return array all views names in the database. The names have NO schema name prefix.
* @since 2.0.9
*/
protected function findViewNames($schema = '')
{
if ($schema === '') {
$schema = $this->defaultSchema;
}
$sql = <<<SQL
SELECT c.relname AS table_name
FROM pg_class c
INNER JOIN pg_namespace ns ON ns.oid = c.relnamespace
WHERE ns.nspname = :schemaName AND c.relkind = 'v'
ORDER BY c.relname
SQL;
$command = $this->db->createCommand($sql, [':schemaName' => $schema]);
$rows = $command->queryAll();
$names = [];
foreach ($rows as $row) {
$names[] = $row['table_name'];
}
return $names;
}
/**
* Returns all view names in the database.
* @param string $schema the schema of the views. Defaults to empty string, meaning the current or default schema name.
* If not empty, the returned view names will be prefixed with the schema name.
* @param boolean $refresh whether to fetch the latest available view names. If this is false,
* view names fetched previously (if available) will be returned.
* @return string[] all view names in the database.
* @since 2.0.9
*/
public function getViewNames($schema = '', $refresh = false)
{
if (!isset($this->_viewNames[$schema]) || $refresh) {
$this->_viewNames[$schema] = $this->findViewNames($schema);
}
return $this->_viewNames[$schema];
}
/**
* Collects the foreign key column details for the given table.
* @param TableSchema $table the table metadata
*/

6
framework/filters/Cors.php

@ -14,8 +14,9 @@ use yii\web\Response;
/**
* Cors filter implements [Cross Origin Resource Sharing](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing).
*
* Make sure to read carefully what CORS does and does not. CORS do not secure your API,
* but allow the developer to grant access to third party code (ajax calls from external domain)
* but allow the developer to grant access to third party code (ajax calls from external domain).
*
* You may use CORS filter by attaching it as a behavior to a controller or module, like the following,
*
@ -58,6 +59,9 @@ use yii\web\Response;
* }
* ```
*
* For more information on how to add the CORS filter to a controller, see
* the [Guide on REST controllers](guide:rest-controllers#cors).
*
* @author Philippe Gaultier <pgaultier@gmail.com>
* @since 2.0
*/

7
framework/helpers/BaseArrayHelper.php

@ -189,7 +189,7 @@ class BaseArrayHelper
$key = $lastKey;
}
if (is_array($array) && array_key_exists($key, $array)) {
if (is_array($array) && (isset($array[$key]) || array_key_exists($key, $array)) ) {
return $array[$key];
}
@ -203,7 +203,7 @@ class BaseArrayHelper
// it is not reliably possible to check whether a property is accessable beforehand
return $array->$key;
} elseif (is_array($array)) {
return array_key_exists($key, $array) ? $array[$key] : $default;
return (isset($array[$key]) || array_key_exists($key, $array)) ? $array[$key] : $default;
} else {
return $default;
}
@ -363,6 +363,9 @@ class BaseArrayHelper
} else {
$value = static::getValue($element, $key);
if ($value !== null) {
if (is_float($value)) {
$value = (string) $value;
}
$lastArray[$value] = $element;
}
}

5
framework/helpers/BaseFileHelper.php

@ -253,7 +253,10 @@ class BaseFileHelper
*/
public static function copyDirectory($src, $dst, $options = [])
{
if ($src === $dst || strpos($dst, $src) === 0) {
$src = static::normalizePath($src);
$dst = static::normalizePath($dst);
if ($src === $dst || strpos($dst, $src . DIRECTORY_SEPARATOR) === 0) {
throw new InvalidParamException('Trying to copy a directory to itself or a subdirectory.');
}
if (!is_dir($dst)) {

14
framework/i18n/migrations/m150207_210500_i18n_init.php

@ -25,26 +25,26 @@ class m150207_210500_i18n_init extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('source_message', [
$this->createTable('{{%source_message}}', [
'id' => $this->primaryKey(),
'category' => $this->string(),
'message' => $this->text(),
], $tableOptions);
$this->createTable('message', [
$this->createTable('{{%message}}', [
'id' => $this->integer()->notNull(),
'language' => $this->string(16)->notNull(),
'translation' => $this->text(),
], $tableOptions);
$this->addPrimaryKey('pk_message_id_language', 'message', ['id', 'language']);
$this->addForeignKey('fk_message_source_message', 'message', 'id', 'source_message', 'id', 'CASCADE', 'RESTRICT');
$this->addPrimaryKey('pk_message_id_language', '{{%message}}', ['id', 'language']);
$this->addForeignKey('fk_message_source_message', '{{%message}}', 'id', '{{%source_message}}', 'id', 'CASCADE', 'RESTRICT');
}
public function down()
{
$this->dropForeignKey('fk_message_source_message', 'message');
$this->dropTable('message');
$this->dropTable('source_message');
$this->dropForeignKey('fk_message_source_message', '{{%message}}');
$this->dropTable('{{%message}}');
$this->dropTable('{{%source_message}}');
}
}

90
framework/messages/tr/yii.php

@ -2,7 +2,7 @@
/**
* Message translations.
*
* This file is automatically generated by 'yii message' command.
* This file is automatically generated by 'yii message/extract' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
@ -19,7 +19,7 @@
return [
'(not set)' => '(Veri Yok)',
'An internal server error occurred.' => 'Bir sunucu hatası oluştu.',
'Are you sure you want to delete this item?' => 'Bu veriyi silmek istediğinizden emin misiniz??',
'Are you sure you want to delete this item?' => 'Bu veriyi silmek istediğinizden emin misiniz?',
'Delete' => 'Sil',
'Error' => 'Hata',
'File upload failed.' => 'Dosya yükleme başarısız.',
@ -29,8 +29,6 @@ return [
'Missing required arguments: {params}' => 'Gerekli argüman eksik: {params}',
'Missing required parameters: {params}' => 'Gerekli parametre eksik: {params}',
'No' => 'Hayır',
'No help for unknown command "{command}".' => 'Bilinmeyen komut "{command}" için bir yardım yok.',
'No help for unknown sub-command "{command}".' => 'Bilinmeyen alt-komut "{command}" için bir yardım yok.',
'No results found.' => 'Sonuç bulunamadı',
'Only files with these MIME types are allowed: {mimeTypes}.' => 'Sadece bu tip MIME türleri geçerlidir: {mimeTypes}.',
'Only files with these extensions are allowed: {extensions}.' => 'Sadece bu tip uzantıları olan dosyalar geçerlidir: {extensions}.',
@ -49,45 +47,81 @@ return [
'The verification code is incorrect.' => 'Doğrulama kodu yanlış.',
'Total <b>{count, number}</b> {count, plural, one{item} other{items}}.' => 'Toplam <b>{count, number}</b> {count, plural, one{öğe} other{öğe}}.',
'Unable to verify your data submission.' => 'İlettiğiniz veri doğrulanamadı.',
'Unknown command "{command}".' => 'Bilinmeyen komut "{command}".',
'Unknown option: --{name}' => 'Bilinmeyen seçenek: --{name}',
'Unknown alias: -{name}' => 'Bilinmeyen rumuz: -{name}',
'Unknown option: --{name}' => 'Bilinmeyen opsiyon: --{name}',
'Update' => 'Güncelle',
'View' => 'İncele',
'View' => 'Görüntüle',
'Yes' => 'Evet',
'You are not allowed to perform this action.' => 'Bu işlemi yapmaya yetkiniz yok.',
'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.' => 'Sadece {limit, number} {limit, plural, one{dosya} other{# dosya}} yükleyebilirsiniz.',
'in {delta, plural, =1{a day} other{# days}}' => '{delta, plural, =1{bir gün} other{# gün}} içerisinde',
'in {delta, plural, =1{a minute} other{# minutes}}' => '{delta, plural, =1{bir dakika} other{# dakika}} içerisinde',
'in {delta, plural, =1{a month} other{# months}}' => '{delta, plural, =1{bir ay} other{# ay}} içerisinde',
'in {delta, plural, =1{a second} other{# seconds}}' => '{delta, plural, =1{bir saniye} other{# saniye}} içerisinde',
'in {delta, plural, =1{a year} other{# years}}' => '{delta, plural, =1{bir yıl} other{# yıl}} içerisinde',
'in {delta, plural, =1{an hour} other{# hours}}' => '{delta, plural, =1{bir saat} other{# saat}} içerisinde',
'just now' => 'henüz',
'the input value' => 'veri giriş değeri',
'{attribute} "{value}" has already been taken.' => '{attribute} "{value}" daha önce alınmış.',
'{attribute} cannot be blank.' => '{attribute} boş bırakılamaz.',
'{attribute} contains wrong subnet mask.' => '{attribute} yanlış alt ağ maskesi içeriyor.',
'{attribute} is invalid.' => '{attribute} geçersiz.',
'{attribute} is not a valid URL.' => '{attribute} geçerli bir URL değil.',
'{attribute} is not a valid email address.' => '{attribute} geçerli bir mail adresi değil.',
'{attribute} is not in the allowed range.' => '{attribute} izin verilen aralıkta değil.',
'{attribute} must be "{requiredValue}".' => '{attribute} {requiredValue} olmalı.',
'{attribute} must be a number.' => '{attribute} sayı olmalı.',
'{attribute} must be a string.' => '{attribute} harf olmalı.',
'{attribute} must be a valid IP address.' => '{attribute} geçerli bir IP adresi değil.',
'{attribute} must be an IP address with specified subnet.' => '{attribute} IP adresi belirtilen alt ağ ile birlikte olmalı.',
'{attribute} must be an integer.' => '{attribute} rakam olmalı.',
'{attribute} must be either "{true}" or "{false}".' => '{attribute} yanlızca {true} yada {false} olabilir.',
'{attribute} must be greater than "{compareValue}".' => '{attribute}, "{compareValue}" den büyük olmalı.',
'{attribute} must be greater than or equal to "{compareValue}".' => '{attribute}, "{compareValue}" den büyük yada eşit olmalı.',
'{attribute} must be less than "{compareValue}".' => '{attribute}, "{compareValue}" den az olmalı.',
'{attribute} must be less than or equal to "{compareValue}".' => '{attribute}, "{compareValue}" den az yada eşit olmalı.',
'{attribute} must be no greater than {max}.' => '{attribute} {max} den büyük olmamalı.',
'{attribute} must be no less than {min}.' => '{attribute} {min} den küçük olmamalı.',
'{attribute} must be repeated exactly.' => '{attribute} aynı şekilde tekrarlanmalıdır.',
'{attribute} must not be equal to "{compareValue}".' => '{attribute}, "{compareValue}" ile eşit olmamalı',
'{attribute} must be either "{true}" or "{false}".' => '{attribute} "{true}" ya da "{false}" olmalı.',
'{attribute} must be equal to "{compareValueOrAttribute}".' => '{attribute} "{compareValueOrAttribute}" değerine eşit olmalı.',
'{attribute} must be greater than "{compareValueOrAttribute}".' => '{attribute} "{compareValueOrAttribute}" değerinden büyük olmalı.',
'{attribute} must be greater than or equal to "{compareValueOrAttribute}".' => '{attribute} "{compareValueOrAttribute}" değerinden büyük veya eşit olmalı.',
'{attribute} must be less than "{compareValueOrAttribute}".' => '{attribute} "{compareValueOrAttribute}" değerinden küçük olmalı.',
'{attribute} must be less than or equal to "{compareValueOrAttribute}".' => '{attribute} "{compareValueOrAttribute}" değerinden küçük veya eşit olmalı.',
'{attribute} must be no greater than {max}.' => '{attribute} {max} değerinden büyük olamaz.',
'{attribute} must be no less than {min}.' => '{attribute} {min} değerinden küçük olamaz.',
'{attribute} must not be a subnet.' => '{attribute} alt ağ olamaz.',
'{attribute} must not be an IPv4 address.' => '{attribute} IPv4 olamaz.',
'{attribute} must not be an IPv6 address.' => '{attribute} IPv6 olamaz.',
'{attribute} must not be equal to "{compareValueOrAttribute}".' => '{attribute} "{compareValueOrAttribute}" değerine eşit olamaz.',
'{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.' => '{attribute} en az {min, number} karakter içermeli.',
'{attribute} should contain at most {max, number} {max, plural, one{character} other{characters}}.' => '{attribute} en fazla {max, number} karakter içermeli.',
'{attribute} should contain {length, number} {length, plural, one{character} other{characters}}.' => '{attribute} {length, number} karakter içermeli.',
'{n, plural, =1{# byte} other{# bytes}}' => '{n} Byte',
'{n, plural, =1{# gigabyte} other{# gigabytes}}' => '{n} Gigabyte',
'{n, plural, =1{# kilobyte} other{# kilobytes}}' => '{n} Kilobyte',
'{n, plural, =1{# megabyte} other{# megabytes}}' => '{n} Megabyte',
'{n, plural, =1{# petabyte} other{# petabytes}}' => '{n} Petabyte',
'{n, plural, =1{# terabyte} other{# terabytes}}' => '{n} Terabyte',
'{n} B' => '{n} B',
'{n} GB' => '{n} GB',
'{n} KB' => '{n} KB',
'{n} MB' => '{n} MB',
'{n} PB' => '{n} PB',
'{n} TB' => '{n} TB',
'{delta, plural, =1{1 day} other{# days}}' => '{delta, plural, =1{1 gün} other{# gün}}',
'{delta, plural, =1{1 hour} other{# hours}}' => '{delta, plural, =1{1 saat} other{# saat}}',
'{delta, plural, =1{1 minute} other{# minutes}}' => '{delta, plural, =1{1 dakika} other{# dakika}}',
'{delta, plural, =1{1 month} other{# months}}' => '{delta, plural, =1{1 ay} other{# ay}}',
'{delta, plural, =1{1 second} other{# seconds}}' => '{delta, plural, =1{1 saniye} other{# saniye}}',
'{delta, plural, =1{1 year} other{# years}}' => '{delta, plural, =1{1 yıl} other{# yıl}}',
'{delta, plural, =1{a day} other{# days}} ago' => '{delta, plural, =1{bir gün} other{# gün}} önce',
'{delta, plural, =1{a minute} other{# minutes}} ago' => '{delta, plural, =1{bir dakika} other{# dakika}} önce',
'{delta, plural, =1{a month} other{# months}} ago' => '{delta, plural, =1{bir ay} other{# ay}} önce',
'{delta, plural, =1{a second} other{# seconds}} ago' => '{delta, plural, =1{bir saniye} other{# saniye}} önce',
'{delta, plural, =1{a year} other{# years}} ago' => '{delta, plural, =1{bir yıl} other{# yıl}} önce',
'{delta, plural, =1{an hour} other{# hours}} ago' => '{delta, plural, =1{bir saat} other{# saat}} önce',
'{nFormatted} B' => '{nFormatted} B',
'{nFormatted} GB' => '{nFormatted} GB',
'{nFormatted} GiB' => '{nFormatted} GiB',
'{nFormatted} KB' => '{nFormatted} KB',
'{nFormatted} KiB' => '{nFormatted} KiB',
'{nFormatted} MB' => '{nFormatted} MB',
'{nFormatted} MiB' => '{nFormatted} MiB',
'{nFormatted} PB' => '{nFormatted} PB',
'{nFormatted} PiB' => '{nFormatted} PiB',
'{nFormatted} TB' => '{nFormatted} TB',
'{nFormatted} TiB' => '{nFormatted} TiB',
'{nFormatted} {n, plural, =1{byte} other{bytes}}' => '{nFormatted} {n, plural, =1{bayt} other{bayt}}',
'{nFormatted} {n, plural, =1{gibibyte} other{gibibytes}}' => '{nFormatted} {n, plural, =1{gibibayt} other{gibibayt}}',
'{nFormatted} {n, plural, =1{gigabyte} other{gigabytes}}' => '{nFormatted} {n, plural, =1{gigabayt} other{gigabayt}}',
'{nFormatted} {n, plural, =1{kibibyte} other{kibibytes}}' => '{nFormatted} {n, plural, =1{kibibayt} other{kibibayt}}',
'{nFormatted} {n, plural, =1{kilobyte} other{kilobytes}}' => '{nFormatted} {n, plural, =1{kilobayt} other{kilobayt}}',
'{nFormatted} {n, plural, =1{mebibyte} other{mebibytes}}' => '{nFormatted} {n, plural, =1{mebibayt} other{mebibayt}}',
'{nFormatted} {n, plural, =1{megabyte} other{megabytes}}' => '{nFormatted} {n, plural, =1{megabayt} other{megabayt}}',
'{nFormatted} {n, plural, =1{pebibyte} other{pebibytes}}' => '{nFormatted} {n, plural, =1{pebibayt} other{pebibayt}}',
'{nFormatted} {n, plural, =1{petabyte} other{petabytes}}' => '{nFormatted} {n, plural, =1{petabayt} other{petabayt}}',
'{nFormatted} {n, plural, =1{tebibyte} other{tebibytes}}' => '{nFormatted} {n, plural, =1{tebibayt} other{tebibayt}}',
'{nFormatted} {n, plural, =1{terabyte} other{terabytes}}' => '{nFormatted} {n, plural, =1{terabayt} other{terabayt}}',
];

42
framework/messages/zh-CN/yii.php

@ -17,6 +17,7 @@
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
'Unknown alias: -{name}' => '未知的别名: -{name}',
'(not set)' => '(未设置)',
'An internal server error occurred.' => '服务器内部错误。',
'Are you sure you want to delete this item?' => '您确定要删除此项吗?',
@ -32,12 +33,16 @@ return [
'No help for unknown command "{command}".' => '命令"{command}"发生未知的错误。',
'No help for unknown sub-command "{command}".' => '子命令"{command}"发生未知的错误。',
'No results found.' => '没有找到数据。',
'Only files with these MIME types are allowed: {mimeTypes}.' => '只允许这些MIME类型的文件: {mimeTypes}。',
'Only files with these extensions are allowed: {extensions}.' => '只允许使用以下文件扩展名的文件:{extensions}。',
'Page not found.' => '页面未找到。',
'Please fix the following errors:' => '请修复以下错误',
'Please upload a file.' => '请上传一个文件。',
'Powered by {yii}' => '技术支持 {yii}',
'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.' => '第<b>{begin, number}-{end, number}</b>条,共<b>{totalCount, number}</b>条数据.',
'The file "{file}" is not an image.' => '文件 "{file}" 不是一个图像文件。',
'The file "{file}" is too big. Its size cannot exceed {formattedLimit}.' => '文件"{file}"太大了。它的大小不能超过{formattedLimit}。',
'The file "{file}" is too small. Its size cannot be smaller than {formattedLimit}.' => '文件"{file}"太小了。它的大小不能小于{formattedLimit}。',
'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => '文件"{file}"太大。它的大小不能超过{limit, number}字节。',
'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => '该文件"{file}"太小。它的大小不得小于{limit, number}字节。',
'The format of {attribute} is invalid.' => '属性 {attribute} 的格式无效。',
@ -45,6 +50,7 @@ return [
'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => '图像"{file}"太大。他的宽度不得超过{limit, number}像素。',
'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => '图像"{file}"太小。他的高度不得小于{limit, number}像素。',
'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => '图像"{file}"太小。他的宽度不得小于{limit, number}像素。',
'The requested view "{name}" was not found.' => '所请求的视图不存在"{name}"。',
'The verification code is incorrect.' => '验证码不正确。',
'Total <b>{count, number}</b> {count, plural, one{item} other{items}}.' => '总计<b>{count, number}</b>条数据。',
'Unable to verify your data submission.' => '您提交的数据无法被验证。',
@ -53,17 +59,22 @@ return [
'Update' => '更新',
'View' => '查看',
'Yes' => '是',
'Yii Framework' => 'Yii 框架',
'You are not allowed to perform this action.' => '您没有执行此操作的权限。',
'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.' => '您最多上传{limit, number}个文件。',
'the input value' => '该输入',
'{attribute} "{value}" has already been taken.' => '{attribute}的值"{value}"已经被占用了。',
'{attribute} cannot be blank.' => '{attribute}不能为空。',
'{attribute} contains wrong subnet mask.' => '{attribute} 属性包含错误的子网掩码。',
'{attribute} is invalid.' => '{attribute}是无效的。',
'{attribute} is not a valid URL.' => '{attribute}不是一条有效的URL。',
'{attribute} is not a valid email address.' => '{attribute}不是有效的邮箱地址。',
'{attribute} is not in the allowed range.' => '{attribute} 不在允许的范围内。',
'{attribute} must be "{requiredValue}".' => '{attribute}必须为"{requiredValue}"。',
'{attribute} must be a number.' => '{attribute}必须是一个数字。',
'{attribute} must be a string.' => '{attribute}必须是一条字符串。',
'{attribute} must be a valid IP address.' => '{attribute} 必须是一个有效的IP地址。',
'{attribute} must be an IP address with specified subnet.' => '{attribute} 必须指定一个IP地址和子网。',
'{attribute} must be an integer.' => '{attribute}必须是整数。',
'{attribute} must be either "{true}" or "{false}".' => '{attribute}的值必须要么为"{true}",要么为"{false}"。',
'{attribute} must be equal to "{compareValueOrAttribute}".' => '{attribute}的值必须等于"{compareValueOrAttribute}"。',
@ -74,6 +85,9 @@ return [
'{attribute} must be less than or equal to "{compareValueOrAttribute}".' => '{attribute}的值必须小于或等于"{compareValueOrAttribute}"。',
'{attribute} must be no greater than {max}.' => '{attribute}的值必须不大于{max}。',
'{attribute} must be no less than {min}.' => '{attribute}的值必须不小于{min}。',
'{attribute} must not be a subnet.' => '{attribute} 必须不是一个子网。',
'{attribute} must not be an IPv4 address.' => '{attribute} 必须不是一个IPv4地址。',
'{attribute} must not be an IPv6 address.' => '{attribute} 必须不是一个IPv6地址。',
'{attribute} must be repeated exactly.' => '{attribute}必须重复。',
'{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.' => '{attribute}应该包含至少{min, number}个字符。',
'{attribute} should contain at most {max, number} {max, plural, one{character} other{characters}}.' => '{attribute}只能包含至多{max, number}个字符。',
@ -84,6 +98,12 @@ return [
'in {delta, plural, =1{an hour} other{# hours}}' => '{delta}小时后',
'in {delta, plural, =1{a minute} other{# minutes}}' => '{delta}分钟后',
'in {delta, plural, =1{a second} other{# seconds}}' => '{delta}秒后',
'{delta, plural, =1{1 day} other{# days}}' => '{delta} 天',
'{delta, plural, =1{1 hour} other{# hours}}' => '{delta} 小时',
'{delta, plural, =1{1 minute} other{# minutes}}' => '{delta} 分钟',
'{delta, plural, =1{1 month} other{# months}}' => '{delta} 月',
'{delta, plural, =1{1 second} other{# seconds}}' => '{delta} 秒',
'{delta, plural, =1{1 year} other{# years}}' => '{delta} 年',
'{delta, plural, =1{a year} other{# years}} ago' => '{delta}年前',
'{delta, plural, =1{a month} other{# months}} ago' => '{delta}个月前',
'{delta, plural, =1{a day} other{# days}} ago' => '{delta}天前',
@ -91,4 +111,26 @@ return [
'{delta, plural, =1{a minute} other{# minutes}} ago' => '{delta}分钟前',
'just now' => '刚刚',
'{delta, plural, =1{a second} other{# seconds}} ago' => '{delta}秒前',
'{nFormatted} B' => '{nFormatted} B',
'{nFormatted} GB' => '{nFormatted} GB',
'{nFormatted} GiB' => '{nFormatted} GiB',
'{nFormatted} KB' => '{nFormatted} KB',
'{nFormatted} KiB' => '{nFormatted} KiB',
'{nFormatted} MB' => '{nFormatted} MB',
'{nFormatted} MiB' => '{nFormatted} MiB',
'{nFormatted} PB' => '{nFormatted} PB',
'{nFormatted} PiB' => '{nFormatted} PiB',
'{nFormatted} TB' => '{nFormatted} TB',
'{nFormatted} TiB' => '{nFormatted} TiB',
'{nFormatted} {n, plural, =1{byte} other{bytes}}' => '{nFormatted} 字节',
'{nFormatted} {n, plural, =1{gibibyte} other{gibibytes}}' => '{nFormatted} 千兆二进制字节',
'{nFormatted} {n, plural, =1{gigabyte} other{gigabytes}}' => '{nFormatted} 千兆字节',
'{nFormatted} {n, plural, =1{kibibyte} other{kibibytes}}' => '{nFormatted} 千位二进制字节',
'{nFormatted} {n, plural, =1{kilobyte} other{kilobytes}}' => '{nFormatted} 千字节',
'{nFormatted} {n, plural, =1{mebibyte} other{mebibytes}}' => '{nFormatted} 兆二进制字节',
'{nFormatted} {n, plural, =1{megabyte} other{megabytes}}' => '{nFormatted} 兆字节',
'{nFormatted} {n, plural, =1{pebibyte} other{pebibytes}}' => '{nFormatted} 拍二进制字节',
'{nFormatted} {n, plural, =1{petabyte} other{petabytes}}' => '{nFormatted} 拍字节',
'{nFormatted} {n, plural, =1{tebibyte} other{tebibytes}}' => '{nFormatted} 太二进制字节',
'{nFormatted} {n, plural, =1{terabyte} other{terabytes}}' => '{nFormatted} 太字节',
];

42
framework/messages/zh-TW/yii.php

@ -17,6 +17,7 @@
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
'Unknown alias: -{name}' => '未知的別名: -{name}',
'(not set)' => '(未設定)',
'An internal server error occurred.' => '內部系統錯誤。',
'Are you sure you want to delete this item?' => '您確定要刪除此項嗎?',
@ -32,12 +33,16 @@ return [
'No help for unknown command "{command}".' => '子命令 "{command}" 發生未知的錯誤。',
'No help for unknown sub-command "{command}".' => '子命令 "{command}" 發生未知的錯誤。',
'No results found.' => '沒有資料。',
'Only files with these MIME types are allowed: {mimeTypes}.' => '只允許這些MIME類型的文件: {mimeTypes}。',
'Only files with these extensions are allowed: {extensions}.' => '只可以使用以下擴充名的檔案:{extensions}。',
'Page not found.' => '找不到頁面。',
'Please fix the following errors:' => '請修正以下錯誤:',
'Please upload a file.' => '請上傳一個檔案。',
'Powered by {yii}' => '技术支持 {yii}',
'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.' => '第 <b>{begin, number}-{end, number}</b> 項,共 <b>{totalCount, number}</b> 項資料.',
'The file "{file}" is not an image.' => '檔案 "{file}" 不是一個圖片檔案。',
'The file "{file}" is too big. Its size cannot exceed {formattedLimit}.' => '檔案"{file}"太大了。它的大小不可以超過{formattedLimit}。',
'The file "{file}" is too small. Its size cannot be smaller than {formattedLimit}.' => '文件"{file}"太小了。它的大小不可以小於{formattedLimit}。',
'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => '檔案 "{file}" 太大。它的大小不可以超過 {limit, number} 位元組。',
'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => '檔案 "{file}" 太小。它的大小不可以小於 {limit, number} 位元組。',
'The format of {attribute} is invalid.' => '屬性 {attribute} 的格式不正確。',
@ -45,6 +50,7 @@ return [
'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => '圖像 "{file}" 太大。它的寬度不可以超過 {limit, number} 像素。',
'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => '圖像 "{file}" 太小。它的高度不可以小於 {limit, number} 像素。',
'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => '圖像 "{file}" 太小。它的寬度不可以小於 {limit, number} 像素。',
'The requested view "{name}" was not found.' => '所請求的視圖不存在"{name}"。',
'The verification code is incorrect.' => '驗證碼不正確。',
'Total <b>{count, number}</b> {count, plural, one{item} other{items}}.' => '總計 <b>{count, number}</b> 項資料。',
'Unable to verify your data submission.' => '您提交的資料無法被驗證。',
@ -53,17 +59,22 @@ return [
'Update' => '更新',
'View' => '查看',
'Yes' => '是',
'Yii Framework' => 'Yii 框架',
'You are not allowed to perform this action.' => '您沒有執行此操作的權限。',
'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.' => '您最多可以上載 {limit, number} 個檔案。',
'the input value' => '該輸入',
'{attribute} "{value}" has already been taken.' => '{attribute} 的值 "{value}" 已經被佔用了。',
'{attribute} cannot be blank.' => '{attribute} 不能為空白。',
'{attribute} contains wrong subnet mask.' => '{attribute} 屬性包含錯誤的子網掩碼。',
'{attribute} is invalid.' => '{attribute} 不正確。',
'{attribute} is not a valid URL.' => '{attribute} 不是一個正確的網址。',
'{attribute} is not a valid email address.' => '{attribute} 不是一個正確的電郵地址。',
'{attribute} is not in the allowed range.' => '{attribute} 不在允許的範圍內。',
'{attribute} must be "{requiredValue}".' => '{attribute}必須為 "{requiredValue}"。',
'{attribute} must be a number.' => '{attribute} 必須為數字。',
'{attribute} must be a string.' => '{attribute} 必須為字串。',
'{attribute} must be a valid IP address.' => '{attribute} 必須是一個有效的IP地址。',
'{attribute} must be an IP address with specified subnet.' => '{attribute} 必須指定一個IP地址和子網。',
'{attribute} must be an integer.' => '{attribute} 必須為整數。',
'{attribute} must be either "{true}" or "{false}".' => '{attribute} 必須為 "{true}" 或 "{false}"。',
'{attribute} must be greater than "{compareValue}".' => '{attribute} 必須大於 "{compareValue}"。',
@ -72,6 +83,9 @@ return [
'{attribute} must be less than or equal to "{compareValue}".' => '{attribute} 必須少或等於 "{compareValue}"。',
'{attribute} must be no greater than {max}.' => '{attribute} 不可以大於 {max}。',
'{attribute} must be no less than {min}.' => '{attribute} 不可以少於 {min}。',
'{attribute} must not be a subnet.' => '{attribute} 必須不是一個子網。',
'{attribute} must not be an IPv4 address.' => '{attribute} 必須不是一個IPv4地址。',
'{attribute} must not be an IPv6 address.' => '{attribute} 必須不是一個IPv6地址。',
'{attribute} must be repeated exactly.' => '{attribute} 必須重複一致。',
'{attribute} must not be equal to "{compareValue}".' => '{attribute} 不可以等於 "{compareValue}"。',
'{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.' => '{attribute} 應該包含至少 {min, number} 個字符。',
@ -83,6 +97,12 @@ return [
'in {delta, plural, =1{an hour} other{# hours}}' => '{delta}小時後',
'in {delta, plural, =1{a minute} other{# minutes}}' => '{delta}分鐘後',
'in {delta, plural, =1{a second} other{# seconds}}' => '{delta}秒後',
'{delta, plural, =1{1 day} other{# days}}' => '{delta} 天',
'{delta, plural, =1{1 hour} other{# hours}}' => '{delta} 小時',
'{delta, plural, =1{1 minute} other{# minutes}}' => '{delta} 分鐘',
'{delta, plural, =1{1 month} other{# months}}' => '{delta} 月',
'{delta, plural, =1{1 second} other{# seconds}}' => '{delta} 秒',
'{delta, plural, =1{1 year} other{# years}}' => '{delta} 年',
'{delta, plural, =1{a year} other{# years}} ago' => '{delta}年前',
'{delta, plural, =1{a month} other{# months}} ago' => '{delta}個月前',
'{delta, plural, =1{a day} other{# days}} ago' => '{delta}天前',
@ -90,4 +110,26 @@ return [
'{delta, plural, =1{a minute} other{# minutes}} ago' => '{delta}分鐘前',
'just now' => '剛剛',
'{delta, plural, =1{a second} other{# seconds}} ago' => '{delta}秒前',
'{nFormatted} B' => '{nFormatted} B',
'{nFormatted} GB' => '{nFormatted} GB',
'{nFormatted} GiB' => '{nFormatted} GiB',
'{nFormatted} KB' => '{nFormatted} KB',
'{nFormatted} KiB' => '{nFormatted} KiB',
'{nFormatted} MB' => '{nFormatted} MB',
'{nFormatted} MiB' => '{nFormatted} MiB',
'{nFormatted} PB' => '{nFormatted} PB',
'{nFormatted} PiB' => '{nFormatted} PiB',
'{nFormatted} TB' => '{nFormatted} TB',
'{nFormatted} TiB' => '{nFormatted} TiB',
'{nFormatted} {n, plural, =1{byte} other{bytes}}' => '{nFormatted} 字節',
'{nFormatted} {n, plural, =1{gibibyte} other{gibibytes}}' => '{nFormatted} 千兆位二進制字節',
'{nFormatted} {n, plural, =1{gigabyte} other{gigabytes}}' => '{nFormatted} 千兆字節',
'{nFormatted} {n, plural, =1{kibibyte} other{kibibytes}}' => '{nFormatted} 千位二進制字節',
'{nFormatted} {n, plural, =1{kilobyte} other{kilobytes}}' => '{nFormatted} 千字節',
'{nFormatted} {n, plural, =1{mebibyte} other{mebibytes}}' => '{nFormatted} 兆位二進制字節',
'{nFormatted} {n, plural, =1{megabyte} other{megabytes}}' => '{nFormatted} 兆字節',
'{nFormatted} {n, plural, =1{pebibyte} other{pebibytes}}' => '{nFormatted} 拍位二進制字節',
'{nFormatted} {n, plural, =1{petabyte} other{petabytes}}' => '{nFormatted} 拍字節',
'{nFormatted} {n, plural, =1{tebibyte} other{tebibytes}}' => '{nFormatted} 太位二進制字節',
'{nFormatted} {n, plural, =1{terabyte} other{terabytes}}' => '{nFormatted} 太字節',
];

27
framework/web/Application.php

@ -124,6 +124,33 @@ class Application extends \yii\base\Application
}
/**
* Returns the error handler component.
* @return ErrorHandler the error handler application component.
*/
public function getErrorHandler()
{
return $this->get('errorHandler');
}
/**
* Returns the request component.
* @return Request the request component.
*/
public function getRequest()
{
return $this->get('request');
}
/**
* Returns the response component.
* @return Response the response component.
*/
public function getResponse()
{
return $this->get('response');
}
/**
* Returns the session component.
* @return Session the session component.
*/

2
framework/web/UploadedFile.php

@ -224,7 +224,7 @@ class UploadedFile extends Object
foreach ($names as $i => $name) {
self::loadFilesRecursive($key . '[' . $i . ']', $name, $tempNames[$i], $types[$i], $sizes[$i], $errors[$i]);
}
} elseif ($errors !== UPLOAD_ERR_NO_FILE) {
} elseif ((int)$errors !== UPLOAD_ERR_NO_FILE) {
self::$_files[$key] = new static([
'name' => $names,
'tempName' => $tempNames,

2
tests/framework/data/ActiveDataProviderTest.php

@ -22,7 +22,7 @@ use yiiunit\data\ar\Order;
* @group data
* @group db
*/
class ActiveDataProviderTest extends DatabaseTestCase
abstract class ActiveDataProviderTest extends DatabaseTestCase
{
protected function setUp()
{

9
tests/framework/db/ActiveRecordTest.php

@ -1,4 +1,5 @@
<?php
namespace yiiunit\framework\db;
use yii\db\ActiveQuery;
@ -16,16 +17,12 @@ use yiiunit\data\ar\OrderWithNullFK;
use yiiunit\data\ar\Profile;
use yiiunit\data\ar\Type;
use yiiunit\framework\ar\ActiveRecordTestTrait;
use yiiunit\framework\db\cubrid\CubridActiveRecordTest;
use yiiunit\framework\db\cubrid\ActiveRecordTest as CubridActiveRecordTest;
use yiiunit\data\ar\Animal;
use yiiunit\data\ar\Cat;
use yiiunit\data\ar\Dog;
/**
* @group db
* @group mysql
*/
class ActiveRecordTest extends DatabaseTestCase
abstract class ActiveRecordTest extends DatabaseTestCase
{
use ActiveRecordTestTrait;

11
tests/framework/db/BatchQueryResultTest.php

@ -1,9 +1,4 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
@ -13,11 +8,7 @@ use yii\db\Query;
use yii\db\BatchQueryResult;
use yiiunit\data\ar\Customer;
/**
* @group db
* @group mysql
*/
class BatchQueryResultTest extends DatabaseTestCase
abstract class BatchQueryResultTest extends DatabaseTestCase
{
public function setUp()
{

16
tests/framework/db/ColumnSchemaBuilderTest.php

@ -1,23 +1,13 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use yii\db\ColumnSchemaBuilder;
use yii\db\Exception;
use yii\db\Expression;
use yii\db\Schema;
use yiiunit\TestCase;
/**
* ColumnSchemaBuilderTest tests ColumnSchemaBuilder
*/
class ColumnSchemaBuilderTest extends TestCase
abstract class ColumnSchemaBuilderTest extends TestCase
{
/**
* @param string $type
@ -35,8 +25,8 @@ class ColumnSchemaBuilderTest extends TestCase
public function typesProvider()
{
return [
['integer', Schema::TYPE_INTEGER, null, [
['unsigned'],
['integer NULL', Schema::TYPE_INTEGER, null, [
['unsigned'], ['null'],
]],
['integer(10)', Schema::TYPE_INTEGER, 10, [
['unsigned'],

25
tests/framework/db/ColumnSchemaTest.php

@ -1,25 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use yii\db\ColumnSchema;
use yii\db\Schema;
use yiiunit\TestCase;
/**
* ColumnSchemaTest tests ColumnSchema
*/
class ColumnSchemaTest extends TestCase
{
public function testDbTypecastWithEmptyCharType()
{
$columnSchema = new ColumnSchema(['type' => Schema::TYPE_CHAR]);
$this->assertSame('', $columnSchema->dbTypecast(''));
}
}

6
tests/framework/db/CommandTest.php

@ -8,11 +8,7 @@ use yii\db\DataReader;
use yii\db\Expression;
use yii\db\Schema;
/**
* @group db
* @group mysql
*/
class CommandTest extends DatabaseTestCase
abstract class CommandTest extends DatabaseTestCase
{
public function testConstruct()
{

6
tests/framework/db/ConnectionTest.php

@ -5,11 +5,7 @@ namespace yiiunit\framework\db;
use yii\db\Connection;
use yii\db\Transaction;
/**
* @group db
* @group mysql
*/
class ConnectionTest extends DatabaseTestCase
abstract class ConnectionTest extends DatabaseTestCase
{
public function testConstruct()

11
tests/framework/db/DatabaseTestCase.php

@ -1,4 +1,5 @@
<?php
namespace yiiunit\framework\db;
use yii\db\Connection;
@ -7,14 +8,22 @@ use yiiunit\TestCase as TestCase;
abstract class DatabaseTestCase extends TestCase
{
protected $database;
protected $driverName = 'mysql';
/**
* @var string the driver name of this test class. Must be set by a subclass.
*/
protected $driverName;
/**
* @var Connection
*/
private $_db;
protected function setUp()
{
if ($this->driverName === null) {
throw new \Exception('driverName is not set for a DatabaseTestCase.');
}
parent::setUp();
$databases = self::getParam('databases');
$this->database = $databases[$this->driverName];

1
tests/framework/db/QueryBuilderTest.php

@ -1024,6 +1024,7 @@ abstract class QueryBuilderTest extends DatabaseTestCase
[ ['in', 'id', (new Query())->select('id')->from('users')->where(['active' => 1])], '[[id]] IN (SELECT [[id]] FROM [[users]] WHERE [[active]]=:qp0)', [':qp0' => 1] ],
[ ['not in', 'id', (new Query())->select('id')->from('users')->where(['active' => 1])], '[[id]] NOT IN (SELECT [[id]] FROM [[users]] WHERE [[active]]=:qp0)', [':qp0' => 1] ],
[ ['in', 'id', 1], '[[id]]=:qp0', [':qp0' => 1] ],
[ ['in', 'id', [1]], '[[id]]=:qp0', [':qp0' => 1] ],
[ ['in', 'id', new TraversableObject([1])], '[[id]]=:qp0', [':qp0' => 1] ],
'composite in' => [

6
tests/framework/db/QueryTest.php

@ -5,11 +5,7 @@ namespace yiiunit\framework\db;
use yii\db\Expression;
use yii\db\Query;
/**
* @group db
* @group mysql
*/
class QueryTest extends DatabaseTestCase
abstract class QueryTest extends DatabaseTestCase
{
public function testSelect()
{

14
tests/framework/db/SchemaTest.php

@ -4,14 +4,11 @@ namespace yiiunit\framework\db;
use PDO;
use yii\caching\FileCache;
use yii\db\ColumnSchema;
use yii\db\Expression;
use yii\db\Schema;
/**
* @group db
* @group mysql
*/
class SchemaTest extends DatabaseTestCase
abstract class SchemaTest extends DatabaseTestCase
{
public function pdoAttributesProvider()
{
@ -373,4 +370,11 @@ class SchemaTest extends DatabaseTestCase
}
}
}
public function testColumnSchemaDbTypecastWithEmptyCharType()
{
$columnSchema = new ColumnSchema(['type' => Schema::TYPE_CHAR]);
$this->assertSame('', $columnSchema->dbTypecast(''));
}
}

5
tests/framework/db/cubrid/CubridActiveDataProviderTest.php → tests/framework/db/cubrid/ActiveDataProviderTest.php

@ -1,14 +1,13 @@
<?php
namespace yiiunit\framework\db\cubrid;
use yiiunit\framework\data\ActiveDataProviderTest;
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
* @group data
*/
class CubridActiveDataProviderTest extends ActiveDataProviderTest
class ActiveDataProviderTest extends \yiiunit\framework\data\ActiveDataProviderTest
{
public $driverName = 'cubrid';
}

6
tests/framework/db/cubrid/CubridActiveRecordTest.php → tests/framework/db/cubrid/ActiveFixtureTest.php

@ -1,13 +1,13 @@
<?php
namespace yiiunit\framework\db\cubrid;
use yiiunit\framework\db\ActiveRecordTest;
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
* @group test
*/
class CubridActiveRecordTest extends ActiveRecordTest
class ActiveFixtureTest extends \yiiunit\framework\test\ActiveFixtureTest
{
public $driverName = 'cubrid';
}

5
tests/framework/db/cubrid/CubridQueryTest.php → tests/framework/db/cubrid/ActiveRecordTest.php

@ -1,13 +1,12 @@
<?php
namespace yiiunit\framework\db\cubrid;
use yiiunit\framework\db\QueryTest;
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
*/
class CubridQueryTest extends QueryTest
class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
{
public $driverName = 'cubrid';
}

12
tests/framework/db/cubrid/BatchQueryResultTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
*/
class BatchQueryResultTest extends \yiiunit\framework\db\BatchQueryResultTest
{
public $driverName = 'cubrid';
}

6
tests/framework/db/cubrid/ColumnSchemaBuilderTest.php

@ -1,14 +1,16 @@
<?php
namespace yiiunit\framework\db\cubrid;
use yii\db\cubrid\ColumnSchemaBuilder;
use yii\db\Schema;
use \yiiunit\framework\db\ColumnSchemaBuilderTest as BaseColumnSchemaBuilderTest;
/**
* ColumnSchemaBuilderTest tests ColumnSchemaBuilder for Cubrid
* @group db
* @group cubrid
*/
class ColumnSchemaBuilderTest extends BaseColumnSchemaBuilderTest
class ColumnSchemaBuilderTest extends \yiiunit\framework\db\ColumnSchemaBuilderTest
{
/**
* @param string $type

5
tests/framework/db/cubrid/CubridCommandTest.php → tests/framework/db/cubrid/CommandTest.php

@ -1,13 +1,12 @@
<?php
namespace yiiunit\framework\db\cubrid;
use yiiunit\framework\db\CommandTest;
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
*/
class CubridCommandTest extends CommandTest
class CommandTest extends \yiiunit\framework\db\CommandTest
{
public $driverName = 'cubrid';

5
tests/framework/db/cubrid/CubridConnectionTest.php → tests/framework/db/cubrid/ConnectionTest.php

@ -1,13 +1,12 @@
<?php
namespace yiiunit\framework\db\cubrid;
use yiiunit\framework\db\ConnectionTest;
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
*/
class CubridConnectionTest extends ConnectionTest
class ConnectionTest extends \yiiunit\framework\db\ConnectionTest
{
public $driverName = 'cubrid';

13
tests/framework/db/cubrid/ExistValidatorTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
* @group validators
*/
class ExistValidatorTest extends \yiiunit\framework\validators\ExistValidatorTest
{
public $driverName = 'cubrid';
}

3
tests/framework/db/cubrid/CubridQueryBuilderTest.php → tests/framework/db/cubrid/QueryBuilderTest.php

@ -3,13 +3,12 @@
namespace yiiunit\framework\db\cubrid;
use yii\db\Schema;
use yiiunit\framework\db\QueryBuilderTest;
/**
* @group db
* @group cubrid
*/
class CubridQueryBuilderTest extends QueryBuilderTest
class QueryBuilderTest extends \yiiunit\framework\db\QueryBuilderTest
{
public $driverName = 'cubrid';

12
tests/framework/db/cubrid/QueryTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
*/
class QueryTest extends \yiiunit\framework\db\QueryTest
{
public $driverName = 'cubrid';
}

4
tests/framework/db/cubrid/CubridSchemaTest.php → tests/framework/db/cubrid/SchemaTest.php

@ -1,14 +1,14 @@
<?php
namespace yiiunit\framework\db\cubrid;
use yii\db\Expression;
use yiiunit\framework\db\SchemaTest;
/**
* @group db
* @group cubrid
*/
class CubridSchemaTest extends SchemaTest
class SchemaTest extends \yiiunit\framework\db\SchemaTest
{
public $driverName = 'cubrid';

13
tests/framework/db/cubrid/UniqueValidatorTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\cubrid;
/**
* @group db
* @group cubrid
* @group validators
*/
class UniqueValidatorTest extends \yiiunit\framework\validators\UniqueValidatorTest
{
public $driverName = 'cubrid';
}

5
tests/framework/db/mssql/MssqlActiveDataProviderTest.php → tests/framework/db/mssql/ActiveDataProviderTest.php

@ -1,14 +1,13 @@
<?php
namespace yiiunit\framework\db\mssql;
use yiiunit\framework\data\ActiveDataProviderTest;
namespace yiiunit\framework\db\mssql;
/**
* @group db
* @group mssql
* @group data
*/
class MssqlActiveDataProviderTest extends ActiveDataProviderTest
class ActiveDataProviderTest extends \yiiunit\framework\data\ActiveDataProviderTest
{
public $driverName = 'sqlsrv';
}

13
tests/framework/db/mssql/ActiveFixtureTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\mssql;
/**
* @group db
* @group mssql
* @group test
*/
class ActiveFixtureTest extends \yiiunit\framework\test\ActiveFixtureTest
{
public $driverName = 'sqlsrv';
}

6
tests/framework/db/mssql/MssqlActiveRecordTest.php → tests/framework/db/mssql/ActiveRecordTest.php

@ -2,15 +2,13 @@
namespace yiiunit\framework\db\mssql;
use yiiunit\framework\db\ActiveRecordTest;
/**
* @group db
* @group mssql
*/
class MssqlActiveRecordTest extends ActiveRecordTest
class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
{
protected $driverName = 'sqlsrv';
public $driverName = 'sqlsrv';
public function testExplicitPkOnAutoIncrement()
{

12
tests/framework/db/mssql/BatchQueryResultTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\mssql;
/**
* @group db
* @group mssql
*/
class BatchQueryResultTest extends \yiiunit\framework\db\BatchQueryResultTest
{
public $driverName = 'sqlsrv';
}

24
tests/framework/db/mssql/ColumnSchemaBuilderTest.php

@ -0,0 +1,24 @@
<?php
namespace yiiunit\framework\db\mssql;
use yii\db\ColumnSchemaBuilder;
use yii\db\Schema;
/**
* ColumnSchemaBuilderTest tests ColumnSchemaBuilder for MSSQL
* @group db
* @group mssql
*/
class ColumnSchemaBuilderTest extends \yiiunit\framework\db\ColumnSchemaBuilderTest
{
/**
* @param string $type
* @param integer $length
* @return ColumnSchemaBuilder
*/
public function getColumnSchemaBuilder($type, $length = null)
{
return new ColumnSchemaBuilder($type, $length);
}
}

3
tests/framework/db/mssql/MssqlCommandTest.php → tests/framework/db/mssql/CommandTest.php

@ -3,13 +3,12 @@
namespace yiiunit\framework\db\mssql;
use yii\db\Schema;
use yiiunit\framework\db\CommandTest;
/**
* @group db
* @group mssql
*/
class MssqlCommandTest extends CommandTest
class CommandTest extends \yiiunit\framework\db\CommandTest
{
protected $driverName = 'sqlsrv';

4
tests/framework/db/mssql/MssqlConnectionTest.php → tests/framework/db/mssql/ConnectionTest.php

@ -2,13 +2,11 @@
namespace yiiunit\framework\db\mssql;
use yiiunit\framework\db\ConnectionTest;
/**
* @group db
* @group mssql
*/
class MssqlConnectionTest extends ConnectionTest
class ConnectionTest extends \yiiunit\framework\db\ConnectionTest
{
protected $driverName = 'sqlsrv';

13
tests/framework/db/mssql/ExistValidatorTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\mssql;
/**
* @group db
* @group mssql
* @group validators
*/
class ExistValidatorTest extends \yiiunit\framework\validators\ExistValidatorTest
{
public $driverName = 'mssql';
}

3
tests/framework/db/mssql/MssqlQueryBuilderTest.php → tests/framework/db/mssql/QueryBuilderTest.php

@ -3,14 +3,13 @@
namespace yiiunit\framework\db\mssql;
use yii\db\mssql\Schema;
use yiiunit\framework\db\QueryBuilderTest;
use yii\db\Query;
/**
* @group db
* @group mssql
*/
class MssqlQueryBuilderTest extends QueryBuilderTest
class QueryBuilderTest extends \yiiunit\framework\db\QueryBuilderTest
{
public $driverName = 'sqlsrv';

4
tests/framework/db/mssql/MssqlQueryTest.php → tests/framework/db/mssql/QueryTest.php

@ -2,13 +2,11 @@
namespace yiiunit\framework\db\mssql;
use yiiunit\framework\db\QueryTest;
/**
* @group db
* @group mssql
*/
class MssqlQueryTest extends QueryTest
class QueryTest extends \yiiunit\framework\db\QueryTest
{
protected $driverName = 'sqlsrv';
}

12
tests/framework/db/mssql/SchemaTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\mssql;
/**
* @group db
* @group mssql
*/
class SchemaTest extends \yiiunit\framework\db\SchemaTest
{
public $driverName = 'sqlsrv';
}

13
tests/framework/db/mssql/UniqueValidatorTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\mssql;
/**
* @group db
* @group mssql
* @group validators
*/
class UniqueValidatorTest extends \yiiunit\framework\validators\UniqueValidatorTest
{
public $driverName = 'sqlsrv';
}

13
tests/framework/db/mysql/ActiveDataProviderTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
* @group data
*/
class ActiveDataProviderTest extends \yiiunit\framework\data\ActiveDataProviderTest
{
public $driverName = 'mysql';
}

13
tests/framework/db/mysql/ActiveFixtureTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
* @group test
*/
class ActiveFixtureTest extends \yiiunit\framework\test\ActiveFixtureTest
{
public $driverName = 'mysql';
}

12
tests/framework/db/mysql/ActiveRecordTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
*/
class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
{
public $driverName = 'mysql';
}

12
tests/framework/db/mysql/BatchQueryResultTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
*/
class BatchQueryResultTest extends \yiiunit\framework\db\BatchQueryResultTest
{
public $driverName = 'mysql';
}

6
tests/framework/db/mysql/ColumnSchemaBuilderTest.php

@ -1,14 +1,16 @@
<?php
namespace yiiunit\framework\db\mysql;
use yii\db\mysql\ColumnSchemaBuilder;
use yii\db\Schema;
use \yiiunit\framework\db\ColumnSchemaBuilderTest as BaseColumnSchemaBuilderTest;
/**
* ColumnSchemaBuilderTest tests ColumnSchemaBuilder for MySQL
* @group db
* @group mysql
*/
class ColumnSchemaBuilderTest extends BaseColumnSchemaBuilderTest
class ColumnSchemaBuilderTest extends \yiiunit\framework\db\ColumnSchemaBuilderTest
{
/**
* @param string $type

12
tests/framework/db/mysql/CommandTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
*/
class CommandTest extends \yiiunit\framework\db\CommandTest
{
public $driverName = 'mysql';
}

12
tests/framework/db/mysql/ConnectionTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
*/
class ConnectionTest extends \yiiunit\framework\db\ConnectionTest
{
protected $driverName = 'mysql';
}

13
tests/framework/db/mysql/ExistValidatorTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
* @group validators
*/
class ExistValidatorTest extends \yiiunit\framework\validators\ExistValidatorTest
{
public $driverName = 'sqlsrv';
}

5
tests/framework/db/mysql/MysqlQueryBuilderTest.php → tests/framework/db/mysql/QueryBuilderTest.php

@ -3,14 +3,15 @@
namespace yiiunit\framework\db\mysql;
use yii\db\Schema;
use yiiunit\framework\db\QueryBuilderTest;
/**
* @group db
* @group mysql
*/
class MysqlQueryBuilderTest extends QueryBuilderTest
class QueryBuilderTest extends \yiiunit\framework\db\QueryBuilderTest
{
protected $driverName = 'mysql';
/**
* this is not used as a dataprovider for testGetColumnType to speed up the test
* when used as dataprovider every single line will cause a reconnect with the database which is not needed here

12
tests/framework/db/mysql/QueryTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
*/
class QueryTest extends \yiiunit\framework\db\QueryTest
{
protected $driverName = 'mysql';
}

12
tests/framework/db/mysql/SchemaTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
*/
class SchemaTest extends \yiiunit\framework\db\SchemaTest
{
public $driverName = 'mysql';
}

13
tests/framework/db/mysql/UniqueValidatorTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\mysql;
/**
* @group db
* @group mysql
* @group validators
*/
class UniqueValidatorTest extends \yiiunit\framework\validators\UniqueValidatorTest
{
public $driverName = 'mysql';
}

13
tests/framework/db/oci/ActiveDataProviderTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\oci;
/**
* @group db
* @group oci
* @group data
*/
class ActiveDataProviderTest extends \yiiunit\framework\data\ActiveDataProviderTest
{
public $driverName = 'oci';
}

13
tests/framework/db/oci/ActiveFixtureTest.php

@ -0,0 +1,13 @@
<?php
namespace yiiunit\framework\db\oci;
/**
* @group db
* @group oci
* @group test
*/
class ActiveFixtureTest extends \yiiunit\framework\test\ActiveFixtureTest
{
public $driverName = 'oci';
}

4
tests/framework/db/oci/OracleActiveRecordTest.php → tests/framework/db/oci/ActiveRecordTest.php

@ -1,7 +1,7 @@
<?php
namespace yiiunit\framework\db\oci;
use yiiunit\framework\db\ActiveRecordTest;
use yiiunit\data\ar\DefaultPk;
use yiiunit\data\ar\Type;
@ -9,7 +9,7 @@ use yiiunit\data\ar\Type;
* @group db
* @group oci
*/
class OracleActiveRecordTest extends ActiveRecordTest
class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
{
protected $driverName = 'oci';

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save