📜 ⬆️ ⬇️

Version 1.0.6

On June 7, another monthly version of the Yii framework , 1.0.6, was released. Consider the list and some details of the most remarkable changes.

Development of named scopes


Added support for named scopes for update () and delete () methods, as well as for with () . You can use the following techniques:


SQL profiling


Added sql query profiling . Thanks to CProfileLogRoute, you can now measure how long each request is executed. You can also use CDbConnection :: getStats () to get the total number of executed SQL queries and their total execution time.
')

Context logging


Added the ability to record additional contextual information in the log (for example, $ _GET, $ _SERVER variables, session identifier, user name, etc.).

This is configured using the CLogRoute :: filter property. For example:

  return array (
     // ... 
     'preload' => array ('log', 'session'),
 
     // ...
     'components' => array (
         // ... 
         'log' => array (
         'class' => 'CLogRouter',
         'routes' => array (
             array (
                 'class' => 'CWebLogRoute',
                 'levels' => 'trace, info, error, warning',
                 'filter' => array (
                     'class' => 'CLogFilter',
                     'prefixSession' => true
                     'prefixUser' => false,
                     'logUser' => false,
                     'logVars' => array (),
                 ),
             ),
         ), 


CNC improvement


Each link translation rule can be configured more flexibly using the urlSuffix and caseSensetive options. Now the transformation rule can take the following form:

'pattern1'=>array('route1', 'urlSuffix'=>'.xml', 'caseSensitive'=>false)

But using CUrlManager :: useStrictParsing, you can enable link translation based solely on rules. Then, for example, links with GET variables that are undefined in the rules will be displayed as / page? Var = value, and not / page / var / value /. This only works if the urlFormat is equal to 'path'.

Error handling in the controller


Yii now allows you to use a controller action for error handling . This is determined in the configuration file:

  return array (
     ......
     'components' => array (
         'errorHandler' => array (
             'errorAction' => 'site / error',
         ),
     ),
 ); 

And in the desired action of the desired controller, use Yii :: app () -> errorHandler-> error.

Other nice little things


Console enhancements


From now on, the console is able to generate models for all database tables as well as automatically links in one request.

File cache


The class for storing the cache in files, which previously appeared as the Yii extension, is now entered into the distribution kit and is called - CFileCache .

CMemCache


Improved and now works with memcache and memcached.

MySQL driver


When using MySQL, tinyint (1) type fields are defined as Boolean.

Using the links in the text, you can more thoroughly examine the highlighted changes.

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


All Articles