diff --git a/docs/guide-es/concept-di-container.md b/docs/guide-es/concept-di-container.md index 391de0a..e8d13fc 100644 --- a/docs/guide-es/concept-di-container.md +++ b/docs/guide-es/concept-di-container.md @@ -75,7 +75,7 @@ En este caso, el contenedor usará una llamada de retorno PHP registrada para co clase. La llamada de retorno se responsabiliza de que dependencias debe inyectar al nuevo objeto creado. Por ejemplo, ```php -$container->set('Foo', function () { +$container->set('Foo', function ($container, $params, $config) { return new Foo(new Bar); }); diff --git a/docs/guide-es/start-installation.md b/docs/guide-es/start-installation.md index 62d0e5a..70a57e4 100644 --- a/docs/guide-es/start-installation.md +++ b/docs/guide-es/start-installation.md @@ -189,7 +189,7 @@ DocumentRoot "path/to/basic/web" Para utilizar [Nginx](http://wiki.nginx.org/), debes instalar PHP como un [FPM SAPI](http://php.net/install.fpm). Utiliza la siguiente configuración de Nginx, reemplazando `path/to/basic/web` con la ruta real a -`basic/web` y `mysite.local` con el hostname real a servir. +`basic/web` y `mysite.test` con el hostname real a servir. ``` server { @@ -199,7 +199,7 @@ server { listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide-fr/concept-di-container.md b/docs/guide-fr/concept-di-container.md index 06af821..0aeb060 100644 --- a/docs/guide-fr/concept-di-container.md +++ b/docs/guide-fr/concept-di-container.md @@ -99,7 +99,7 @@ $container->get('Foo', [], [ Dans ce cas, le conteneur utilise une fonction de rappel PRP enregistrée pour construire de nouvelles instances d'une classe. À chaque fois que [[yii\di\Container::get()]] est appelée, la fonction de rappel correspondante est invoquée. Cette fonction de rappel est chargée de la résolution des dépendances et de leur injection appropriée dans les objets nouvellement créés. Par exemple : ```php -$container->set('Foo', function () { +$container->set('Foo', function ($container, $params, $config) { $foo = new Foo(new Bar); // ... autres initialisations ... return $foo; @@ -113,7 +113,7 @@ Pour cacher la logique complexe de construction des nouveaux objets, vous pouvez ```php class FooBuilder { - public static function build() + public static function build($container, $params, $config) { $foo = new Foo(new Bar); // ... autres initialisations ... diff --git a/docs/guide-fr/start-installation.md b/docs/guide-fr/start-installation.md index 24a1c49..fa36149 100644 --- a/docs/guide-fr/start-installation.md +++ b/docs/guide-fr/start-installation.md @@ -120,7 +120,7 @@ DocumentRoot "path/to/basic/web" ### Configuration Nginx recommandée Pour utiliser Nginx, vous devez avoir installé PHP en utilisant [FPM SAPI](http://php.net/install.fpm). -Utilisez la configuration Nginx suivante, en remplaçant `path/to/basic/web` par le chemin vers le dossier `basic/web` et `mysite.local` par le nom d'hôte de votre serveur. +Utilisez la configuration Nginx suivante, en remplaçant `path/to/basic/web` par le chemin vers le dossier `basic/web` et `mysite.test` par le nom d'hôte de votre serveur. ``` server { @@ -130,7 +130,7 @@ server { listen 80; ## port pour ipv4 #listen [::]:80 default_server ipv6only=on; ## port pour ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide-fr/tutorial-i18n.md b/docs/guide-fr/tutorial-i18n.md index 147a93e..6929531 100644 --- a/docs/guide-fr/tutorial-i18n.md +++ b/docs/guide-fr/tutorial-i18n.md @@ -327,7 +327,7 @@ tandis que `one` correspond à `21` ou `101`: ``` Ces noms d'arguments spéciaux tels que `other`, `few`, `many` et autres varient en fonction de la langue. Pour savoir lesquels utiliser pour une locale particulière, reportez-vous aux "Plural Rules, Cardinal" à [http://intl.rmcreative.ru/](http://intl.rmcreative.ru/). -En alternative, vous pouvez vous reporter aux [rules reference at unicode.org](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html). +En alternative, vous pouvez vous reporter aux [rules reference at unicode.org](http://cldr.unicode.org/index/cldr-spec/plural-rules). > Note: le message en russe ci-dessus est principalement utilisé comme message traduit, pas comme message source, sauf si vous définissez la [[yii\base\Application::$sourceLanguage|langue source]] de votre application comme étant `ru-RU` et traduisez à partir du russe. > diff --git a/docs/guide-id/start-installation.md b/docs/guide-id/start-installation.md index 6fce5c4..54fb407 100644 --- a/docs/guide-id/start-installation.md +++ b/docs/guide-id/start-installation.md @@ -189,7 +189,7 @@ DocumentRoot "path/to/basic/web" Untuk menggunakan [Nginx](http://wiki.nginx.org/), Anda harus menginstal PHP sebagai [FPM SAPI](http://php.net/install.fpm). Anda dapat menggunakan konfigurasi Nginx berikut, menggantikan `path/to/basic/web` dengan path yang sebenarnya untuk -`basic/web` dan `mysite.local` dengan hostname yang sebenarnya untuk server. +`basic/web` dan `mysite.test` dengan hostname yang sebenarnya untuk server. ```nginx server { @@ -199,7 +199,7 @@ server { listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide-it/start-installation.md b/docs/guide-it/start-installation.md index 1bfb50c..7315f29 100644 --- a/docs/guide-it/start-installation.md +++ b/docs/guide-it/start-installation.md @@ -161,7 +161,7 @@ DocumentRoot "path/to/basic/web" ### Configurazione consigliata di Nginx Devi aver installato PHP con il demone [FPM](http://php.net/install.fpm) per usare [Nginx](http://wiki.nginx.org/). -Usa questa configurazione per Nginx, sostituendo `path/to/basic/web` con il percorso reale di `basic/web` e `mysite.local` con +Usa questa configurazione per Nginx, sostituendo `path/to/basic/web` con il percorso reale di `basic/web` e `mysite.test` con il nome reale del server web. ``` @@ -172,7 +172,7 @@ server { listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide-ja/concept-di-container.md b/docs/guide-ja/concept-di-container.md index ea85c0a..6a76670 100644 --- a/docs/guide-ja/concept-di-container.md +++ b/docs/guide-ja/concept-di-container.md @@ -114,7 +114,7 @@ $container->get('Foo', [], [ たとえば ```php -$container->set('Foo', function () { +$container->set('Foo', function ($container, $params, $config) { $foo = new Foo(new Bar); // ... その他の初期化 ... return $foo; @@ -129,7 +129,7 @@ $foo = $container->get('Foo'); ```php class FooBuilder { - public static function build() + public static function build($container, $params, $config) { $foo = new Foo(new Bar); // ... その他の初期化 ... @@ -413,7 +413,7 @@ $container->setDefinitions([ 'class' => 'app\components\Response', 'format' => 'json' ], - 'app\storage\DocumentsReader' => function () { + 'app\storage\DocumentsReader' => function ($container, $params, $config) { $fs = new app\storage\FileStorage('/var/tempfiles'); return new app\storage\DocumentsReader($fs); } diff --git a/docs/guide-ja/start-installation.md b/docs/guide-ja/start-installation.md index 917ad5f..f9a07d6 100644 --- a/docs/guide-ja/start-installation.md +++ b/docs/guide-ja/start-installation.md @@ -202,7 +202,7 @@ DocumentRoot "path/to/basic/web" [Nginx](http://wiki.nginx.org/) を使うためには、PHP を [FPM SAPI](http://jp1.php.net/install.fpm) としてインストールしなければなりません。 下記の Nginx の設定を使うことができます。 -`path/to/basic/web` の部分を `basic/web` の実際のパスに置き換え、`mysite.local` を実際のサーバのホスト名に置き換えてください。 +`path/to/basic/web` の部分を `basic/web` の実際のパスに置き換え、`mysite.test` を実際のサーバのホスト名に置き換えてください。 ```nginx server { @@ -212,7 +212,7 @@ server { listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide-ja/tutorial-i18n.md b/docs/guide-ja/tutorial-i18n.md index 81a1397..809d46f 100644 --- a/docs/guide-ja/tutorial-i18n.md +++ b/docs/guide-ja/tutorial-i18n.md @@ -459,7 +459,7 @@ echo \Yii::t('app', 'There {n,plural,=0{are no cats} =1{is one cat} other{are # これら `other`、`few`、`many` などの特別な引数の名前は言語によって異なります。 特定のロケールに対してどんな引数を指定すべきかを学ぶためには、[http://intl.rmcreative.ru/](http://intl.rmcreative.ru/) の "Plural Rules, Cardinal" を参照してください。 -あるいは、その代りに、[unicode.org の規則のリファレンス](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html) を参照することも出来ます。 +あるいは、その代りに、[unicode.org の規則のリファレンス](http://cldr.unicode.org/index/cldr-spec/plural-rules) を参照することも出来ます。 > Note: 上記のロシア語のメッセージのサンプルは、主として翻訳メッセージとして使用されるものです。 diff --git a/docs/guide-pl/start-installation.md b/docs/guide-pl/start-installation.md index bbb122d..c11aac4 100644 --- a/docs/guide-pl/start-installation.md +++ b/docs/guide-pl/start-installation.md @@ -203,7 +203,7 @@ DocumentRoot "path/to/basic/web" Aby użyć [Nginx](http://wiki.nginx.org/) powinienieś zainstalować PHP jako [FPM SAPI](http://php.net/install.fpm). Możesz użyć przedstawionej poniżej konfiguracji Nginx, zastępując jedynie ścieżkę `path/to/basic/web` aktualną ścieżką do `basic/web` Twojej aplikacji oraz -`mysite.local` aktualną nazwą hosta. +`mysite.test` aktualną nazwą hosta. ```nginx server { @@ -213,7 +213,7 @@ server { listen 80; ## nasłuchuj ipv4 #listen [::]:80 default_server ipv6only=on; ## nasłuchuj ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide-pt-BR/concept-di-container.md b/docs/guide-pt-BR/concept-di-container.md index f0b0739..cb511ae 100644 --- a/docs/guide-pt-BR/concept-di-container.md +++ b/docs/guide-pt-BR/concept-di-container.md @@ -75,7 +75,7 @@ Cada vez que [[yii\di\Container::get()]] for chamado, o callable correspondente O callable é responsável por resolver as dependências e injetá-las de forma adequada para os objetos recém-criados. Por exemplo: ```php -$container->set('Foo', function () { +$container->set('Foo', function ($container, $params, $config) { $foo = new Foo(new Bar); // ... Outras inicializações... return $foo; @@ -89,7 +89,7 @@ Para ocultar a lógica complexa da construção de um novo objeto você pode usa ```php class FooBuilder { - public static function build() + public static function build($container, $params, $config) { return function () { $foo = new Foo(new Bar); diff --git a/docs/guide-pt-BR/start-installation.md b/docs/guide-pt-BR/start-installation.md index 8023e63..e210981 100644 --- a/docs/guide-pt-BR/start-installation.md +++ b/docs/guide-pt-BR/start-installation.md @@ -202,7 +202,7 @@ DocumentRoot "path/to/basic/web" Você deve ter instalado o PHP como um [FPM SAPI](http://php.net/install.fpm) para usar o [Nginx](http://wiki.nginx.org/). Use a seguinte configuração do Nginx, -substituindo `path/to/basic/web` com o caminho real para `basic/web` e `mysite.local` +substituindo `path/to/basic/web` com o caminho real para `basic/web` e `mysite.test` com o nome de host real a servidor. ``` @@ -213,7 +213,7 @@ server { listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide-ru/README.md b/docs/guide-ru/README.md index 61c06c8..99d4ff3 100644 --- a/docs/guide-ru/README.md +++ b/docs/guide-ru/README.md @@ -79,7 +79,7 @@ All Rights Reserved. * [Active Record](db-active-record.md) - Получение объектов AR, работа с ними и определение связей. * [Миграции](db-migrations.md) - Контроль версий схемы данных при работе в команде. * [Sphinx](https://github.com/yiisoft/yii2-sphinx/blob/master/docs/guide-ru/README.md) -* [Redis](https://github.com/yiisoft/yii2-redis/blob/master/docs/guide/README.md) +* [Redis](https://github.com/yiisoft/yii2-redis/blob/master/docs/guide-ru/README.md) * [MongoDB](https://github.com/yiisoft/yii2-mongodb/blob/master/docs/guide-ru/README.md) * [ElasticSearch](https://github.com/yiisoft/yii2-elasticsearch/blob/master/docs/guide/README.md) @@ -175,6 +175,7 @@ All Rights Reserved. * [Окружение виртуального хостинга](tutorial-shared-hosting.md) * [Шаблонизаторы](tutorial-template-engines.md) * [Работа со сторонним кодом](tutorial-yii-integration.md) +* [Использование Yii в качестве микро-framework'а](tutorial-yii-as-micro-framework.md) Виджеты diff --git a/docs/guide-ru/concept-di-container.md b/docs/guide-ru/concept-di-container.md index aaaa3ad..07d083f 100644 --- a/docs/guide-ru/concept-di-container.md +++ b/docs/guide-ru/concept-di-container.md @@ -151,7 +151,7 @@ $container->setDefinitions([ 'class' => 'app\components\Response', 'format' => 'json' ], - 'app\storage\DocumentsReader' => function () { + 'app\storage\DocumentsReader' => function ($container, $params, $config) { $fs = new app\storage\FileStorage('/var/tempfiles'); return new app\storage\DocumentsReader($fs); } @@ -243,7 +243,7 @@ $reader = $container->get('app\storage\DocumentsReader'); Callback отвечает за разрешения зависимостей и внедряет их в соответствии с вновь создаваемыми объектами. Например, ```php -$container->set('Foo', function () { +$container->set('Foo', function ($container, $params, $config) { $foo = new Foo(new Bar); // ... дополнительная инициализация return $foo; @@ -258,7 +258,7 @@ callable: ```php class FooBuilder { - public static function build() + public static function build($container, $params, $config) { $foo = new Foo(new Bar); // ... дополнительная инициализация ... diff --git a/docs/guide-ru/output-data-widgets.md b/docs/guide-ru/output-data-widgets.md index 71f173a..9f4c917 100644 --- a/docs/guide-ru/output-data-widgets.md +++ b/docs/guide-ru/output-data-widgets.md @@ -222,6 +222,13 @@ echo GridView::widget([ 'attribute' => 'birthday', 'format' => ['date', 'php:Y-m-d'] ], + 'created_at:datetime', // короткий вид записи формата + [ + 'label' => 'Education', + 'attribute' => 'education', + 'filter' => ['0' => 'Elementary', '1' => 'Secondary', '2' => 'Higher'], + 'filterInputOptions' => ['prompt' => 'All educations', 'class' => 'form-control', 'id' => null] + ], ], ]); ``` @@ -235,6 +242,13 @@ echo GridView::widget([ Для конфигурации колонок данных также доступен короткий вид записи, который описан в API документации для [[yii\grid\GridView::columns|колонок]]. +Используйте [[yii\grid\DataColumn::filter|filter]] и [[yii\grid\DataColumn::filterInputOptions|filterInputOptions]] для +настройки HTML кода фильтра. + +По умолчанию заголовки колонок генерируются используя [[yii\data\Sort::link]]. Это можно изменить через свойство +[[yii\grid\Column::header]]. Для изменения заголовка нужно задать [[yii\grid\DataColumn::$label]], как в +примере выше. По умолчанию текст будет взят из модели данных. Подробное описание ищите в [[yii\grid\DataColumn::getHeaderCellLabel]]. + #### ActionColumn [[yii\grid\ActionColumn|ActionColumn]] отображает кнопки действия, такие как изменение или удаление для каждой строки. diff --git a/docs/guide-ru/output-formatting.md b/docs/guide-ru/output-formatting.md index 4afb759..395f06f 100644 --- a/docs/guide-ru/output-formatting.md +++ b/docs/guide-ru/output-formatting.md @@ -36,9 +36,8 @@ Formatter может быть использован двумя различны [[yii\i18n\Formatter::locale|locale]]. Если оно не было настроено, то в качестве локали будет использован [[yii\base\Application::language|язык приложения]]. Подробнее смотрите в разделе «[интернационализация](tutorial-i18n.md)». Компонент форматирования будет выбирать корректный формат для даты и чисел в соответствии с локалью, включая имена -месяцев и дней недели, переведённые на текущий язык. Форматирование дат также зависит от -[[yii\i18n\Formatter::timeZone|часового пояса]], которая -также будет из свойства [[yii\base\Application::timeZone|timeZone]] приложения, если она не была задана явно. +месяцев и дней недели, переведённые на текущий язык. +Форматирование дат также зависит от [[yii\i18n\Formatter::timeZone|часового пояса]], который будет взят из одноимённого свойства [[yii\base\Application::timeZone|timeZone]] приложения, если не был задан явно. В свою очередь [[yii\base\Application::timeZone|timeZone]] устанавливает / читает временную зону PHP. Например, форматирование даты, вызванное с разной локалью, отобразит разные результаты:: @@ -140,16 +139,14 @@ echo Yii::$app->formatter->asTime('2014-10-06 12:41:00'); // 14:41:00 echo Yii::$app->formatter->asTime('2014-10-06 14:41:00 CEST'); // 14:41:00 ``` -Начиная с версии 2.0.1 стало возможно настраивать часовой пояс для предполагаемых timestamp, которые не включают в себя -часовой пояс, как во втором примере в коде выше. Вы можете задать [[yii\i18n\Formatter::defaultTimeZone]] часовым поясом, -который вы используете для хранения данных. - -> Note: Поскольку часовые пояса являются субъектом ответственности правительств по всему миру и могут часто меняться, -> это значит, что вы, вероятно, не имеете самую свежую информацию в базе данных часовых поясов, установленной на вашем сервере. -> Вы можете обратиться к [ICU руководству](http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data) -> для получения подробностей об обновлении базы данных часовых поясов. -> См. также: [Настройка вашего PHP окружения для интернационализации](tutorial-i18n.md#setup-environment). +Если [[yii\i18n\Formatter::timeZone|часовой пояс форматтера]] не задан явно, используется +[[yii\base\Application::timeZone|часовой пояс приложения]], то есть тот же, что задан в +конфигурации PHP. +> Note: Поскольку правила для часовых поясов принимаются различными правительствами и могут часто меняться, +> вероятно, информация в базе данных часовых поясов на вашем сервере не самая свежая. +> Как обновить базу вы можете узнать из [руководства ICU](http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data). +> Смотрите также: [Настройка вашего PHP окружения для интернационализации](tutorial-i18n.md#setup-environment). Форматирование чисел ------------------ diff --git a/docs/guide-ru/rest-resources.md b/docs/guide-ru/rest-resources.md index ee148e4..9cc2f76 100644 --- a/docs/guide-ru/rest-resources.md +++ b/docs/guide-ru/rest-resources.md @@ -50,9 +50,9 @@ http://localhost/users?fields=id,email&expand=profile [[yii\db\ActiveRecord::fields()]] возвращает только те атрибуты, которые были объявлены в схеме БД. Вы можете переопределить `fields()` для того, чтобы добавить, удалить, переименовать или переобъявить поля. Значение, -возвращаемое `fields()`, должно быть массивом. Его ключи это имена полей, и значения могут быть либо именами -свойств/атрибутов, либо анонимными функциями, которые возвращают значение соответствующих полей. Если имя атрибута такое же, -как ключ массива вы можете опустить значение: +возвращаемое `fields()`, должно быть массивом. Его ключи — это названия полей. Значения могут быть либо именами +свойств/атрибутов, либо анонимными функциями, которые возвращают значение соответствующих свойств. Когда +название поля совпадает с именем аттрибута вы можете опустить ключ массива: ```php // явное перечисление всех атрибутов лучше всего использовать когда вы хотите быть уверенным что изменение @@ -61,11 +61,11 @@ http://localhost/users?fields=id,email&expand=profile public function fields() { return [ - // название поля совпадает с названием атрибута + // название поля совпадает с именем атрибута 'id', - // имя поля "email", атрибут "email_address" + // название поля "email", атрибут "email_address" 'email' => 'email_address', - // имя поля "name", значение определяется callback-ом PHP + // название поля "name", значение определяется callback-ом PHP 'name' => function () { return $this->first_name . ' ' . $this->last_name; }, @@ -77,7 +77,7 @@ public function fields() { $fields = parent::fields(); - // удаляем не безопасные поля + // удаляем небезопасные поля unset($fields['auth_key'], $fields['password_hash'], $fields['password_reset_token']); return $fields; diff --git a/docs/guide-ru/runtime-logging.md b/docs/guide-ru/runtime-logging.md index d9a4059..cf7bcb1 100644 --- a/docs/guide-ru/runtime-logging.md +++ b/docs/guide-ru/runtime-logging.md @@ -49,7 +49,9 @@ Yii::trace('начало вычисления среднего дохода', __ return [ // Компонент "log" должен быть загружен на этапе предзагрузки 'bootstrap' => ['log'], - + // Компонент "log" обрабатывает сообщения с меткой времени timestamp. + // Задайте временную зону для создания корректных меток времени. + 'timeZone' => 'Europe/Moscow', 'components' => [ 'log' => [ 'targets' => [ diff --git a/docs/guide-ru/start-installation.md b/docs/guide-ru/start-installation.md index db185b7..d9eccdc 100644 --- a/docs/guide-ru/start-installation.md +++ b/docs/guide-ru/start-installation.md @@ -176,7 +176,7 @@ DocumentRoot "path/to/basic/web" PHP должен быть установлен как [FPM SAPI](http://php.net/manual/ru/install.fpm.php) для [Nginx](http://wiki.nginx.org/). Используйте следующие параметры Nginx и не забудьте заменить `path/to/basic/web` на корректный путь к `basic/web` и -`mysite.local` на ваше имя хоста. +`mysite.test` на ваше имя хоста. ``` server { @@ -186,7 +186,7 @@ server { listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## слушаем ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide-ru/structure-modules.md b/docs/guide-ru/structure-modules.md index 78d3e67..ebd2a95 100644 --- a/docs/guide-ru/structure-modules.md +++ b/docs/guide-ru/structure-modules.md @@ -171,6 +171,13 @@ yii // из идентификатора модуля, то контроллер и действие определяются исходя из свойства [[yii\base\Module::defaultRoute]], которое по умолчанию равно `default`. Таким образом, маршрут `forum` соответствует контроллеру `default` модуля `forum`. +Добавление маршрутов модуля в URL manager необходимо производить до начала работы [[yii\web\UrlManager::parseRequest()]], что не +позволяет размещать код добавления правил модуля в `init()`, так как инициализация происходит уже после обработки маршрутов. Таким образом, добавление маршрутов необходимо осуществить в [предзагрузке +модуля](structure-extensions.md#bootstrapping-classes). Хорошей практикой, также, будет объединение всех правил модуля +при помощи [[\yii\web\GroupUrlRule]]. + +Если же вы используете модуль для [версионирования API](rest-versioning.md), добавление маршрутов необходимо +производить непосредственно в конфигурации `urlManager` приложения. ### Получение доступа к модулям diff --git a/docs/guide-ru/tutorial-i18n.md b/docs/guide-ru/tutorial-i18n.md index 1a2f187..5d70ee8 100644 --- a/docs/guide-ru/tutorial-i18n.md +++ b/docs/guide-ru/tutorial-i18n.md @@ -269,7 +269,7 @@ for an argument: U_ARGUMENT_TYPE_MISMATCH": ``` Подробная документация о формах склонений для различных языков доступна на сайте -[unicode.org](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html). +[unicode.org](http://cldr.unicode.org/index/cldr-spec/plural-rules). #### Вариации diff --git a/docs/guide-ru/tutorial-yii-as-micro-framework.md b/docs/guide-ru/tutorial-yii-as-micro-framework.md new file mode 100644 index 0000000..193d035 --- /dev/null +++ b/docs/guide-ru/tutorial-yii-as-micro-framework.md @@ -0,0 +1,206 @@ +# Использование Yii в качестве микро-framework'а + +Yii можно легко использовать без функций включенных в базовый и расширенный шаблоны приложений. Другими словами Yii уже является микро-каркасом. Не требуется иметь структуру каталогов предоставляемую этими шаблонами при работе с Yii. + +Это особенно удобно, когда Вам не нужен весь пред-установленный шаблонный код, такой как `Assets` или `Views`. Одним из таких случаев является создание JSON API. В следующих разделах будет показано, как это сделать. + +## Установка Yii + +Создайте каталог для файлов проекта и смените рабочий каталог на этот путь. В примерах используются команды Unix, но аналогичные команды существуют и в Windows. + +```bash +mkdir micro-app +cd micro-app +``` + +> Note: Для продолжения требуется немного знаний о Composer. Если Вы еще не знаете, как использовать Composer, пожалуйста, найдите время, чтобы прочитать [Руководство Composer](https://getcomposer.org/doc/00-intro.md). + +Создайте файл `composer.json` в каталоге `micro-app` с помощью Вашего любимого редактора и добавьте следующее: + +```json +{ + "require": { + "yiisoft/yii2": "~2.0.0" + }, + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org" + } + ] +} +``` + +Сохраните файл и запустите команду `comper install`. Это установит framework со всеми его зависимостями. + +## Создание структуры проекта + +После того как Вы установили фреймворк, пришло время создать [входную точку](structure-entry-scripts.md) приложения. Точка входа - это самый первый файл, который будет выполнен при попытке открыть приложение. По соображениям безопасности рекомендуется поместить файл точки входа в отдельный каталог и сделать каталог корнем веб директории. + +Создайте каталог `web` и поместите в него файл `index.php` со следующим содержимым: + +```php +run(); +``` + +Также создайте файл с именем `config.php`, который будет содержать всю конфигурацию приложения: + +```php + 'micro-app', + // basePath (базовый путь) приложения будет каталог `micro-app` + 'basePath' => __DIR__, + // это пространство имен где приложение будет искать все контроллеры + 'controllerNamespace' => 'micro\controllers', + // установим псевдоним '@micro', чтобы включить автозагрузку классов из пространства имен 'micro' + 'aliases' => [ + '@micro' => __DIR__, + ], +]; +``` + +> Info: Несмотря на то, что конфигурация приложения может находиться в файле `index.php` рекомендуется +> содержать её в отдельном файле. Таким образом её можно также использовать и для консольного приложения, как показано ниже. + +Теперь Ваш проект готов к наполнению кодом. Вам решать какую структуру каталогов проекта Вы выберите, пока Вы сможете видеть пространства имен. + +## Создание первого контроллера + +Создайте каталог `controllers` и добавьте туда файл `SiteController.php` который является контроллером по умолчанию, он будет обрабатывать запрос без пути. + +```php + 'default/index'`. + +На данный момент структура проекта должна выглядеть так: + +``` +micro-app/ +├── composer.json +├── web/ + └── index.php +└── controllers/ + └── SiteController.php +``` + +Если Вы еще не настроили веб-сервер, Вы можете взглянуть на [примеры конфигурационных файлов веб-серверов](start-installation.md#Настройка-веб-сервера-). +Другой возможностью является использование команды `yii serve` которая будет использовать встроенный веб-сервер PHP. Вы можете запустить её из каталога `micro-app/` через: + + vendor/bin/yii serve --docroot=./web + +При открытии URL приложения в браузере, он теперь должен печатать "Hello World!" который был возвращен из `SiteController::actionIndex()`. + +> Info: В нашем примере мы изменили пространство имен по умолчанию приложения с `app` на` micro`, чтобы продемонстрировать +> что Вы не привязаны к этому имени (в случае, если Вы считали, что это так), а затем скорректировали +> [[yii\base\Application::$controllerNamespace|controllers namespace]] и установили правильный псевдоним. + +## Создание REST API + +Чтобы продемонстрировать использование нашей "микроархитектуры" мы создадим простой REST API для сообщений. + +Чтобы этот API обслуживал некоторые данные, нам нужна база данных. Добавим конфигурацию подключения базы данных +к конфигурации приложения: + +```php +'components' => [ + 'db' => [ + 'class' => 'yii\db\Connection', + 'dsn' => 'sqlite:@micro/database.sqlite', + ], +], +``` + +> Info: Для простоты мы используем базу данных sqlite. Дополнительную информацию см. в [Руководство по базам данных](db-dao.md). + +Затем мы создаем [миграции базы данных](db-migrations.md) для создания таблицы сообщений. +Убедитесь, что у Вас есть отдельный файл конфигурации, как описано выше, нам это нужно для того, чтобы запустить консольные команды описанные ниже. +Запуск следующих команд создаст файл миграции базы данных и применит миграцию к базе данных: + + vendor/bin/yii migrate/create --appconfig=config.php create_post_table --fields="title:string,body:text" + vendor/bin/yii migrate/up --appconfig=config.php + +Создайте каталог `models` и файл` Post.php` в этом каталоге. Это код модели: + +```php + Info: Созданная модель представляет собой класс ActiveRecord, который представляет данные из таблицы `posts`. +> Для получения дополнительной информации обратитесь к [active record руководству](db-active-record.md). + +Чтобы обслуживать сообщения в нашем API, добавьте `PostController` в` controllers`: + +```php +get('Foo', [], [ 这种情况下,容器将使用一个注册过的 PHP 回调创建一个类的新实例。回调负责解决依赖并将其恰当地注入新创建的对象。例如: ```php -$container->set('Foo', function () { +$container->set('Foo', function ($container, $params, $config) { return new Foo(new Bar); }); diff --git a/docs/guide-zh-CN/start-installation.md b/docs/guide-zh-CN/start-installation.md index d3d366a..9d2044f 100644 --- a/docs/guide-zh-CN/start-installation.md +++ b/docs/guide-zh-CN/start-installation.md @@ -132,7 +132,7 @@ DocumentRoot "path/to/basic/web" ### 推荐使用的 Nginx 配置 -为了使用 [Nginx](http://wiki.nginx.org/),你应该已经将 PHP 安装为 [FPM SAPI](http://php.net/install.fpm) 了。使用如下 Nginx 配置,将 `path/to/basic/web` 替换为实际的 `basic/web` 目录,`mysite.local` 替换为实际的主机名以提供服务。 +为了使用 [Nginx](http://wiki.nginx.org/),你应该已经将 PHP 安装为 [FPM SAPI](http://php.net/install.fpm) 了。使用如下 Nginx 配置,将 `path/to/basic/web` 替换为实际的 `basic/web` 目录,`mysite.test` 替换为实际的主机名以提供服务。 ``` server { @@ -142,7 +142,7 @@ server { listen 80; ## 监听 ipv4 上的 80 端口 #listen [::]:80 default_server ipv6only=on; ## 监听 ipv6 上的 80 端口 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide/README.md b/docs/guide/README.md index 5827aed..297bed0 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -18,6 +18,7 @@ Introduction Getting Started --------------- +* [What do you need to know](start-prerequisites.md) * [Installing Yii](start-installation.md) * [Running Applications](start-workflow.md) * [Saying Hello](start-hello.md) diff --git a/docs/guide/concept-di-container.md b/docs/guide/concept-di-container.md index 67b95f5..665d049 100644 --- a/docs/guide/concept-di-container.md +++ b/docs/guide/concept-di-container.md @@ -117,7 +117,7 @@ The callable is responsible to resolve the dependencies and inject them appropri created objects. For example, ```php -$container->set('Foo', function () { +$container->set('Foo', function ($container, $params, $config) { $foo = new Foo(new Bar); // ... other initializations ... return $foo; @@ -131,7 +131,7 @@ To hide the complex logic for building a new object, you may use a static class ```php class FooBuilder { - public static function build() + public static function build($container, $params, $config) { $foo = new Foo(new Bar); // ... other initializations ... @@ -421,7 +421,7 @@ $container->setDefinitions([ 'class' => 'app\components\Response', 'format' => 'json' ], - 'app\storage\DocumentsReader' => function () { + 'app\storage\DocumentsReader' => function ($container, $params, $config) { $fs = new app\storage\FileStorage('/var/tempfiles'); return new app\storage\DocumentsReader($fs); } diff --git a/docs/guide/concept-events.md b/docs/guide/concept-events.md index 8bee769..ba79137 100644 --- a/docs/guide/concept-events.md +++ b/docs/guide/concept-events.md @@ -42,7 +42,7 @@ Attaching Event Handlers You can attach a handler to an event by calling the [[yii\base\Component::on()]] method. For example: ```php -$foo = new Foo; +$foo = new Foo(); // this handler is a global function $foo->on(Foo::EVENT_HELLO, 'function_name'); @@ -355,3 +355,74 @@ done through the Singleton (e.g. the application instance). However, because the namespace of the global events is shared by all parties, you should name the global events wisely, such as introducing some sort of namespace (e.g. "frontend.mail.sent", "backend.mail.sent"). + + +Wildcard Events +--------------- + +Since 2.0.14 you can setup event handler for multiple events matching wildcard pattern. +For example: + +```php +use Yii; + +$foo = new Foo(); + +$foo->on('foo.event.*', function ($event) { + // triggered for any event, which name starts on 'foo.event.' + Yii::trace('trigger event: ' . $event->name); +}); +``` + +Wildcard patterns can be used for class-level events as well. For example: + +```php +use yii\base\Event; +use Yii; + +Event::on('app\models\*', 'before*', function ($event) { + // triggered for any class in namespace 'app\models' for any event, which name starts on 'before' + Yii::trace('trigger event: ' . $event->name . ' for class: ' . get_class($event->sender)); +}); +``` + +This allows you catching all application events by single handler using following code: + +```php +use yii\base\Event; +use Yii; + +Event::on('*', '*', function ($event) { + // triggered for any event at any class + Yii::trace('trigger event: ' . $event->name); +}); +``` + +> Note: usage wildcards for event handlers setup may reduce the application performance. + It is better to be avoided if possible. + +In order to detach event handler specified by wildcard pattern, you should repeat same pattern at +[[yii\base\Component::off()]] or [[yii\base\Event::off()]] invocation. Keep in mind that passing wildcard +during detaching of event handler will detach ony the handler specified for this wildcard, while handlers +attached for regular event names will remain even if they match the pattern. For example: + +```php +use Yii; + +$foo = new Foo(); + +// attach regular handler +$foo->on('event.hello', function ($event) { + echo 'direct-handler' +}); + +// attach wildcard handler +$foo->on('*', function ($event) { + echo 'wildcard-handler' +}); + +// detach wildcard handler only! +$foo->off('*'); + +$foo->trigger('event.hello'); // outputs: 'direct-handler' +``` diff --git a/docs/guide/db-migrations.md b/docs/guide/db-migrations.md index c2e0996..faefb81 100644 --- a/docs/guide/db-migrations.md +++ b/docs/guide/db-migrations.md @@ -38,6 +38,13 @@ command `yii help migrate`. > Tip: migrations could affect not only database schema but adjust existing data to fit new schema, create RBAC hierarchy or clean up cache. +> Note: When manipulating data using a migration you may find that using your [Active Record](db-active-record.md) classes +> for this might be useful because some of the logic is already implemented there. Keep in mind however, that in contrast +> to code written in the migrations, who's nature is to stay constant forever, application logic is subject to change. +> So when using Active Record in migration code, changes to the logic in the Active Record layer may accidentally break +> existing migrations. For this reason migration code should be kept independent from other application logic such +> as Active Record classes. + ## Creating Migrations @@ -716,14 +723,6 @@ Below is the list of all these database accessing methods: > ``` -> Note: When manipulating data using a migration you may find that using your [Active Record](db-active-record.md) classes -> for this might be useful because some of the logic is already implemented there. Keep in mind however, that in contrast -> to code written in the migrations, who's nature is to stay constant forever, application logic is subject to change. -> So when using Active Record in migration code, changes to the logic in the Active Record layer may accidentally break -> existing migrations. For this reason migration code should be kept independent from other application logic such -> as Active Record classes. - - ## Applying Migrations To upgrade a database to its latest structure, you should apply all available new migrations using the following command: diff --git a/docs/guide/output-data-widgets.md b/docs/guide/output-data-widgets.md index eb54081..52a4713 100644 --- a/docs/guide/output-data-widgets.md +++ b/docs/guide/output-data-widgets.md @@ -243,6 +243,13 @@ echo GridView::widget([ 'attribute' => 'birthday', 'format' => ['date', 'php:Y-m-d'] ], + 'created_at:datetime', // shortcut format + [ + 'label' => 'Education', + 'attribute' => 'education', + 'filter' => ['0' => 'Elementary', '1' => 'Secondary', '2' => 'Higher'], + 'filterInputOptions' => ['prompt' => 'All educations', 'class' => 'form-control', 'id' => null] + ], ], ]); ``` @@ -256,6 +263,12 @@ For a list of available formatters see the [section about Data Formatting](outpu For configuring data columns there is also a shortcut format which is described in the API documentation for [[yii\grid\GridView::columns|columns]]. +Use [[yii\grid\DataColumn::filter|filter]] and [[yii\grid\DataColumn::filterInputOptions|filterInputOptions]] to +control HTML for the filter input. + +By default, column headers are rendered by [[yii\data\Sort::link]]. It could be adjusted using [[yii\grid\Column::header]]. +To change header text you should set [[yii\grid\DataColumn::$label]] like in the example above. +By default the label will be populated from data model. For more details see [[yii\grid\DataColumn::getHeaderCellLabel]]. #### Action column diff --git a/docs/guide/output-formatting.md b/docs/guide/output-formatting.md index 58134d6..2d9291a 100644 --- a/docs/guide/output-formatting.md +++ b/docs/guide/output-formatting.md @@ -144,12 +144,15 @@ echo Yii::$app->formatter->asTime('2014-10-06 12:41:00'); // 14:41:00 echo Yii::$app->formatter->asTime('2014-10-06 14:41:00 CEST'); // 14:41:00 ``` +If the [[yii\i18n\Formatter::timeZone|time zone]] is not set explicitly on the formatter component, the +[[yii\base\Application::timeZone|time zone configured in the application]] is used, which is the same time zone +as set in the PHP configuration. + > Note: As time zones are subject to rules made by the governments around the world and may change frequently, it is > likely that you do not have the latest information in the time zone database installed on your system. > You may refer to the [ICU manual](http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data) > for details on updating the time zone database. Please also read -> [Setting up your PHP environment for internationalization](tutorial-i18n.md#setup-environment). - +> [Setting up your PHP environment for internationalization](tutorial-i18n.md#setup-environment). ## Formatting Numbers diff --git a/docs/guide/runtime-logging.md b/docs/guide/runtime-logging.md index 54f4fc9..8fb8fb3 100644 --- a/docs/guide/runtime-logging.md +++ b/docs/guide/runtime-logging.md @@ -83,11 +83,11 @@ return [ ], ], ], - ], + ], ]; ``` -In the above code, two log targets are registered: +In the above code, two log targets are registered: * the first target selects error and warning messages and saves them in a database table; * the second target selects error messages under the categories whose names start with `yii\db\`, and sends @@ -321,3 +321,44 @@ log target classes included in the Yii release. > Tip: Instead of creating your own loggers you may try using PSR-3 compatible targets. +## Performance Profiling + +Performance profiling is a special type of message logging that is used to measure the time taken by certain +code blocks and find out what are the performance bottlenecks. For example, the [[yii\db\Command]] class uses +performance profiling to find out the time taken by each DB query. + +To use performance profiling, first identify the code blocks that need to be profiled. Then enclose each +code block like the following: + +```php +\Yii::beginProfile('myBenchmark'); + +...code block being profiled... + +\Yii::endProfile('myBenchmark'); +``` + +where `myBenchmark` stands for a unique token identifying a code block. Later when you examine the profiling +result, you will use this token to locate the time spent by the corresponding code block. + +It is important to make sure that the pairs of `beginProfile` and `endProfile` are properly nested. +For example, + +```php +\Yii::beginProfile('block1'); + + // some code to be profiled + + \Yii::beginProfile('block2'); + // some other code to be profiled + \Yii::endProfile('block2'); + +\Yii::endProfile('block1'); +``` + +If you miss `\Yii::endProfile('block1')` or switch the order of `\Yii::endProfile('block1')` and +`\Yii::endProfile('block2')`, the performance profiling will not work. + +For each code block being profiled, a log message with the severity level `profile` is recorded. You can configure +a [log target](#log-targets) to collect such messages and export them. The [Yii debugger](tool-debugger.md) has +a built-in performance profiling panel showing the profiling results. diff --git a/docs/guide/security-authorization.md b/docs/guide/security-authorization.md index 4ceef18..6edea60 100644 --- a/docs/guide/security-authorization.md +++ b/docs/guide/security-authorization.md @@ -225,6 +225,8 @@ return [ 'components' => [ 'authManager' => [ 'class' => 'yii\rbac\DbManager', + // uncomment if you want to cache RBAC items hierarchy + // 'cache' => 'cache', ], // ... ], @@ -264,7 +266,7 @@ Building authorization data is all about the following tasks: Depending on authorization flexibility requirements the tasks above could be done in different ways. If your permissions hierarchy is meant to be changed by developers only, you can use either migrations or a console command. Migration pro is that it could be executed along with other migrations. Console -command pro is that you have a good overview of the hierarchy in the code rathe than it being scattered +command pro is that you have a good overview of the hierarchy in the code rather than it being scattered among multiple migrations. Either way in the end you'll get the following RBAC hierarchy: diff --git a/docs/guide/start-installation.md b/docs/guide/start-installation.md index bd78012..019b87b 100644 --- a/docs/guide/start-installation.md +++ b/docs/guide/start-installation.md @@ -211,7 +211,7 @@ DocumentRoot "path/to/basic/web" To use [Nginx](http://wiki.nginx.org/), you should install PHP as an [FPM SAPI](http://php.net/install.fpm). You may use the following Nginx configuration, replacing `path/to/basic/web` with the actual path for -`basic/web` and `mysite.local` with the actual hostname to serve. +`basic/web` and `mysite.test` with the actual hostname to serve. ```nginx server { @@ -221,7 +221,7 @@ server { listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 - server_name mysite.local; + server_name mysite.test; root /path/to/basic/web; index index.php; diff --git a/docs/guide/start-prerequisites.md b/docs/guide/start-prerequisites.md new file mode 100644 index 0000000..6956193 --- /dev/null +++ b/docs/guide/start-prerequisites.md @@ -0,0 +1,22 @@ +# What do you need to know + +Yii learning curve is not as steep as other PHP frameworks but still it requires some beforehand knowledge. + +## PHP + +Yii is a PHP framework so make sure you [read and understand language reference](http://php.net/manual/en/langref.php). + +## Object oriented programming + +Basic understanding of object oriented programming is required. If you're not familiar with it, check one of the many +tutorials available such as [the one from tuts+](https://code.tutsplus.com/tutorials/object-oriented-php-for-beginners--net-12762). + +Note that the more complicated your application is the more advanced OOP concepts your should learn in order to successfully +manage that complexity. + +## Command line and composer + +Yii extensively uses de-facto standard PHP package manager, [Composer](https://getcomposer.org/) so make sure you read +and understand its guide. If you are not familiar with using command line it is time to start trying. Once you'll +learn the basics you'll never want to work without it. + diff --git a/docs/guide/structure-assets.md b/docs/guide/structure-assets.md index 25b3f93..46f9313 100644 --- a/docs/guide/structure-assets.md +++ b/docs/guide/structure-assets.md @@ -194,8 +194,8 @@ class FontAwesomeAsset extends AssetBundle ]; public $publishOptions = [ 'only' => [ - 'fonts/', - 'css/', + 'fonts/*', + 'css/*', ] ]; } diff --git a/docs/guide/structure-modules.md b/docs/guide/structure-modules.md index 255b545..245c90c 100644 --- a/docs/guide/structure-modules.md +++ b/docs/guide/structure-modules.md @@ -176,6 +176,14 @@ only contains the module ID, then the [[yii\base\Module::defaultRoute]] property will determine which controller/action should be used. This means a route `forum` would represent the `default` controller in the `forum` module. +URL manager routes should be added before [[yii\web\UrlManager::parseRequest()]] is fired. That means doing it +in module's `init()` won't work because module will be initialized when routes were already processed. Thus, routes +should be added at [bootstrap stage](structure-extensions.md#bootstrapping-classes). It is a also a good practice +to wrap module's URL rules with [[\yii\web\GroupUrlRule]]. + +In case module is used to [version API](rest-versioning.md), routes should be added directly in `urlManager` +section of the application config. + ### Accessing Modules diff --git a/docs/guide/test-fixtures.md b/docs/guide/test-fixtures.md index 76d32c2..d301f68 100644 --- a/docs/guide/test-fixtures.md +++ b/docs/guide/test-fixtures.md @@ -154,7 +154,10 @@ You may also assign an alias to a fixture. In the above example, the `UserProfil In the test methods, you may then access a fixture object using its alias in `grabFixture()` method. For example, ```php -$profile = $I->grabFixture('profiles', 'user1');` will return the `UserProfileFixture` object. +$profile = $I->grabFixture('profiles', 'user1'); +``` + +will return the `UserProfileFixture` object. Because `UserProfileFixture` extends from `ActiveFixture`, you may further use the following syntax to access the data provided by the fixture: diff --git a/docs/guide/tutorial-i18n.md b/docs/guide/tutorial-i18n.md index 7962e0f..c470cea 100644 --- a/docs/guide/tutorial-i18n.md +++ b/docs/guide/tutorial-i18n.md @@ -416,7 +416,7 @@ while `one` matches `21` or `101`: These `other`, `few`, `many` and other special argument names vary depending on language. To learn which ones you should specify for a particular locale, please refer to "Plural Rules, Cardinal" at [http://intl.rmcreative.ru/](http://intl.rmcreative.ru/). -Alternatively you can refer to [rules reference at unicode.org](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html). +Alternatively you can refer to [rules reference at unicode.org](http://cldr.unicode.org/index/cldr-spec/plural-rules). > Note: The above example Russian message is mainly used as a translated message, not an original message, unless you set > the [[yii\base\Application::$sourceLanguage|source language]] of your application as `ru-RU` and translating from Russian. diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 44bcf75..db82426 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -45,29 +45,66 @@ Yii Framework 2 Change Log 2.0.14 under development ------------------------ -- Enh #15335: Added `FileHelper::unlink()` that works well under all OSes (samdark) -- Bug #15142: Fixed array params replacing in `yii\helpers\BaseUrl::current()` (IceJOKER) -- Bug #15249: Controllers in subdirectories were not visible in commands list (IceJOKER) -- Enh #5515: Added default value for `yii\behaviors\BlameableBehavior` for cases when the user is guest (dmirogin) -- Bug #14276: Fixed I18N format with dotted parameters (developeruz) +- Enh #15496: CSRF token is now regenerated on changing identity (samdark, rhertogh) +- Enh #15417: Added `yii\validators\FileValidator::$minFiles` (vladis84) - Bug #8983: Only truncate the original log file for rotation (matthewyang, developeruz) +- Bug #14157: Add support for loading default value `CURRENT_TIMESTAMP` of MySQL `datetime` field (rossoneri) +- Bug #14276: Fixed I18N format with dotted parameters (developeruz) +- Bug #14484: Fixed `yii\validators\UniqueValidator` for target classes with a default scope (laszlovl, developeruz) - Bug #14604: Fixed `yii\validators\CompareValidator` `compareAttribute` does not work if `compareAttribute` form ID has been changed (mikk150) +- Bug #14903: Fixed route with extra dashes is executed controller while it should not (developeruz) +- Bug #15046: Throw an `yii\web\HeadersAlreadySentException` if headers were sent before web response (dmirogin) +- Bug #15142: Fixed array params replacing in `yii\helpers\BaseUrl::current()` (IceJOKER) +- Bug #15169: Fixed translating a string when NULL parameter is passed (developeruz) - Bug #15194: Fixed `yii\db\QueryBuilder::insert()` to preserve passed params when building a `INSERT INTO ... SELECT` query for MSSQL, PostgreSQL and SQLite (sergeymakinen) - Bug #15229: Fixed `yii\console\widgets\Table` default value for `getScreenWidth()`, when `Console::getScreenSize()` can't determine screen size (webleaf) - Bug #15234: Fixed `\yii\widgets\LinkPager` removed `tag` from `disabledListItemSubTagOptions` (SDKiller) +- Bug #15249: Controllers in subdirectories were not visible in commands list (IceJOKER) +- Bug #15270: Resolved potential race conditions when writing generated php-files (kalessil) +- Bug #15301: Fixed `ArrayHelper::filter()` to work properly with `0` in values (hhniao) +- Bug #15302: Fixed `yii\caching\DbCache` so that `getValues` now behaves the same as `getValue` with regards to streams (edwards-sj) +- Bug #15317: Regenerate CSRF token if an empty value is given (sammousa) +- Bug #15320: Fixed special role checks in `yii\filters\AccessRule::matchRole()` (Izumi-kun) +- Bug #15322: Fixed PHP 7.2 compatibility of `FileHelper::getExtensionsByMimeType()` (samdark) +- Bug #15353: Remove side effect of ActiveQuery::getTablesUsedInFrom() introduced in 2.0.13 (terales) +- Bug #15355: Fixed `yii\db\Query::from()` does not work with `yii\db\Expression` (vladis84, silverfire, samdark) +- Bug #15356: Fixed multiple bugs in `yii\db\Query::getTablesUsedInFrom()` (vladis84, samdark) +- Bug #15380: `FormatConverter::convertDateIcuToPhp()` now converts `a` ICU symbols to `A` (brandonkelly) +- Bug #15407: Fixed rendering rows with associative arrays in `yii\console\widgets\Table` (dmrogin) +- Bug #15432: Fixed wrong value being set in `yii\filters\RateLimiter::checkRateLimit()` resulting in wrong `X-Rate-Limit-Reset` header value (bizley) +- Bug #15440: Fixed `yii\behaviors\AttributeTypecastBehavior::$attributeTypes` auto-detection fails for rule, which specify attribute with '!' prefix (klimov-paul) +- Bug #15462: Fixed `accessChecker` configuration error (developeruz) +- Enh #3087: Added `yii\helpers\BaseHtml::error()` "errorSource" option to be able to customize errors display (yanggs07, developeruz, silverfire) +- Enh #3250: Added support for events partial wildcard matching (klimov-paul) +- Enh #5515: Added default value for `yii\behaviors\BlameableBehavior` for cases when the user is guest (dmirogin) +- Enh #7988: Added `\yii\helpers\Console::errorSummary()` and `\yii\helpers\Json::errorSummary()` (developeruz) +- Enh #7996: Short syntax for verb in GroupUrlRule (schojniak, developeruz) +- Enh #8752: Allow specify `$attributeNames` as a string for `yii\base\Model` `validate()` method (developeruz) - Enh #9137: Added `Access-Control-Allow-Method` header for the OPTIONS request (developeruz) -- Enh #15135: Automatic completion for help in bash and zsh (Valkeru) -- Enh #14662: Added support for custom `Content-Type` specification to `yii\web\JsonResponseFormatter` (Kolyunya) +- Enh #9253: Allow `variations` to be a string for `yii\filters\PageCache` and `yii\widgets\FragmentCache` (schojniak, developeruz) +- Enh #12623: Added `yii\helpers\StringHelper::matchWildcard()` replacing usage of `fnmatch()`, which may be unreliable (klimov-paul) +- Enh #14043: Added `yii\helpers\IpHelper` (silverfire, cebe) +- Enh #14355: Added ability to pass an empty array as a parameter in console command (developeruz) - Enh #14568: Refactored migration templates to use `safeUp()` and `safeDown()` methods (Kolyunya) +- Enh #14662: Added support for custom `Content-Type` specification to `yii\web\JsonResponseFormatter` (Kolyunya) +- Enh #15024: `yii\web\Pjax` widget does not prevent CSS files from sending anymore because they are handled by client-side plugin correctly (onmotion) +- Enh #15135: Automatic completion for help in bash and zsh (Valkeru) +- Enh #15219: Added `yii\filters\auth\HttpHeaderAuth` (bboure) - Enh #15221: Added support for specifying `--camelCase` console options in `--kebab-case` (brandonkelly) - Enh #15221: Added support for the `--