- Action filter
- Performance improvements
- Schema builder and migrations
- Data providers and widgets
- Refactorings
- Assets
- Logging
- Markdown
We are very pleased to announce the release of Yii Framework version 2.0.9. Please refer to the instructions at http://www.yiiframework.com/download/ to install or upgrade to this version.
Version 2.0.9 is a minor release of Yii 2.0 which contains about 60 minor new features and bug fixes.
There are two minor changes that may affect your existing applications so check the UPGRADE.md file.
Thanks to our awesome Yii community which supplied us with valuable pull requests and discussions. The release wouldn't be possible without you!
You may follow the development progress of Yii 2 by starring or watching Yii 2.0 GitHub Project. You may also follow Yii Twitter feeds or join Yii Facebook group to connect with other Yii developers. There is also a forum thread about this news announcement.
Below we summarize some of most important features/fixes included in this release. A complete list of changes can be found in the CHANGELOG.
Action filter ¶
\yii\base\ActionFilter
now supports wildcards for only
and except
options which is
useful when it's attached to the module or application:
return [
'as filter' => [
'class' => 'app\filters\SomeFilter',
'only' => [
'particular/*', // all actions in controller 'particular'
'*/captcha', // all 'captcha' actions in all controllers
],
],
// ...
];
Performance improvements ¶
- Message translation performance was increased for database backend by examining queries and adding proper indexes.
- Oracle database schema was improved to be read faster.
Schema builder and migrations ¶
Schema builder which is used in migrations got some enhancements.
First of all, there's a new method null()
to specify nullability explicitly. Also the column nullability
is now set automatically in case default value is null
.
$type = $this->string(42)->null();
Moreover, a new method was added to append custom SQL to the end of query generated:
$type = $this->string(15)->notNull()->append('collate ascii_bin')->append('character set ascii');
Migrations syntax for automatic generation of code was adjusted a bit. _table
and _column
suffixes
are now required:
./yii migrate/create create_user_table
./yii migrate/create add_name_column_to_user_table
Data providers and widgets ¶
This release enhancements for grids and providers are all about labels. \yii\data\ArrayDataProvider
got a $modelClass
property that specifies a model which is used to provide column labels when data array is empty. Additionally \yii\grid\DataColumn
, which
defines base behavior for all data columns, is now trying to extract attribute label from the filterModel
of the grid in case it
cannot get it otherwise.
Refactorings ¶
A sub-interface called CheckAccessInterface
was extracted from RBAC ManagerInterface
which could be useful for custom
access checking implementations.
\yii\web\User::loginByCookie()
was refactored in order to make it easier to override.
Assets ¶
When listing files in an asset bundle you can set paths to null
to tell asset manager not to register them at all.
It is useful for registering extra scripts for development environment:
<?php
namespace common\assets;
use yii\web\AssetBundle;
class ReactAsset extends AssetBundle
{
public $sourcePath = null;
public $js = [
YII_ENV_DEV ? "//fb.me/react-15.0.1.js" : "//fb.me/react-15.0.1.min.js",
YII_ENV_DEV ? "//fb.me/react-dom-15.0.1.js" : "//fb.me/react-dom-15.0.1.min.js",
YII_ENV_DEV ? "//cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.js" : null,
];
}
Logging ¶
\yii\log\Target::$logVars
now supports fine-grained configurations of what's to be logged:
_SESSION
- log global session variable. That's the same as before._SESSION.id
- log onlyid
from session.!_SESSION.secret
- don't logsecret
from session.
The logic for such filtering was extracted to \yii\helpers\ArrayHelper::filter()
so you can
use it if needed.
Markdown ¶
You can now configure default flavor for yii\helpers\Markdown
calls via $defaultFlavor
.