Version 1.0.6

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

    Named scopes development

    Added support for named scopes for the update () and delete () methods, as well as for with () . You can use the following techniques:
    • Post::model()->published()->recently()->delete();

    • $posts=Post::model()->with('comments:recently:approved')->findAll();

    • class User extends CActiveRecord
          public function relations ()
              return array (
                  'posts' => array (self :: HAS_MANY, 'Post', 'authorID',
                      'with' => 'comments: approved'),

    SQL Profiling

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

    Context Logging

    Now you can write additional contextual information to the log (for example, the variables $ _GET, $ _SERVER, session identifier, username, etc.).

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

    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 conversion rule can take the following form:

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

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

    Error handling in the controller

    Yii now allows you to use a controller action to handle errors . 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 improvements

    From now on, the console can generate models for all database tables with one request, as well as automatically connect.

    File cache

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


    Improved and now works with memcache and memcached.

    MySQL driver

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

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

    Also popular now: