Yii 1.1.9

    A stable version of the Yii PHP framework with the number 1.1.9 has been released. This release contains about 60 improvements and bug fixes.

    A complete list of changes can be found in the corresponding file . Before upgrading from earlier versions, it’s important to read the instructions .

    The Russian-language documentation, as usual, is in a completely up-to-date state. In addition, all typos found at the time of release have been fixed. Thanks to everyone who uses Orphus on yiiframework.ru.

    Consider the most interesting changes.

    A more convenient way to define `through` in an ActiveRecord relationship

    The though option was added in version 1.1.7, but the syntax was not very convenient, so it was decided to make it more explicit. The current syntax uses the following syntax:

    'comments' => array (self :: HAS_MANY, 'Comment', array ('key1' => 'key2'), 'through' => 'posts'),

    In the above array('key1'=>'key2'):

    - key1is the key defined in the relation that is indicated in through(in our case, this posts).
    - key2is the key defined in the model that the relation indicates (in our case, this Comment).

    through can be used for both HAS_ONE and HAS_MANY .

    This feature is described in more detail in the Relational Active Record section of the complete guide.

    Support for condition groups in Model :: relations ()

    Now you can use condition groups when defining model relationships:

    'recentApprovedComments' => array (self :: BELONGS_TO, 'Post', 'post_id', 
        'scopes' => array ('approved', 'recent')),

    When using only one group of conditions, it can be specified as a string.

    Ability to make JOIN between models by given keys

    In this version, it became possible to create relations for a given pair PK-> FK without relying on a data scheme. This means that, for example, you can specify the following relationship for the model Day:

    'jobs' => array (self :: HAS_MANY, 'Job', array ('date' => 'target_date')),

    In this case, it Daymay contain several Jobs. However, they are not connected in the usual way. We set the key in the form array('fk'=>'pk'), that is, at the output we get SQL like

    SELECT * FROM day t
    JOIN job ON t.date = job.target_date

    Ability to override kernel classes with Yii :: $ classMap

    Starting from 1.1.5, in Yii, it was possible to import classes in advance and use them without explicit import or include. Now using the same approach, you can override the kernel classes .

    Also popular now: