📜 ⬆️ ⬇️

Yii 2.0.9

Version 2.0.9 of the Yii PHP framework has been released. The minor release contains about 60 minor improvements and fixes . Installation instructions can be found on the official website.


In this version there are two changes that, although unlikely, can affect your applications. Check out UPGRADE.md .


Thanks to the Yii community for pull requests and discussions.
This release came out thanks to you!


You can watch the development of the framework on GitHub . We also have Twitter
and facebook .



Next we look at the most interesting improvements in more detail. A complete list of changes and fixes can be found in CHANGELOG .


Action filter


\yii\base\ActionFilter now supports masks for only and except , which is useful when
the filter is hung on the module or application entirely:


 return [ 'as filter' => [ 'class' => 'app\filters\SomeFilter', 'only' => [ 'particular/*', //    'particular' '*/captcha', //   'captcha'   ], ], // ... ]; 

Performance improvements



Schema and Migration Builder


The schema builder that is used in migrations has been improved. Added a new method null() to indicate the ability to write null explicitly. The method is applied automatically if the default value is null .


 $type = $this->string(42)->null(); 

Also added a method for your SQL:


 $type = $this->string(15)->notNull()->append('collate ascii_bin')->append('character set ascii'); 

The command syntax for generating migrations has been slightly modified: _table and _column now required:


 ./yii migrate/create create_user_table ./yii migrate/create add_name_column_to_user_table 

Data Providers and Widgets


All improvements in this release are headlines. In \yii\data\ArrayDataProvider added the $modelClass property, through which you can specify the model to get the field headers. In addition, \yii\grid\DataColumn , which defines the behavior for all data columns, is now trying to get headers from the filterModel grid.


Refactoring


From the ManagerInterface RBAC interface, ManagerInterface identified CheckAccessInterface , which can be useful when implementing its access check.


\yii\web\User::loginByCookie() refactored for greater extensibility.


Assets


When listing files in asset packages, you can now set the path to null . In this case, the files are not registered. This is useful, for example, to register additional files for the working environment:


 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 can now be configured more finely:



The logic of such filtering is in \yii\helpers\ArrayHelper::filter() . If necessary, you can use at home.


Markdown


The default syntax type for yii\helpers\Markdown can now be set via $defaultFlavor .


')

Source: https://habr.com/ru/post/305432/


All Articles