Yii 1.1.16 is released

Dec 21, 2014

We are very pleased to announce that Yii Framework version 1.1.16 is released. You can download it at yiiframework.com/download/.

In this release, we have included more than 120 enhancements and bug fixes. For the complete list of changes in this release, please see the change log. NOTE This release contains changes that break backward compatibility. Please read the upgrading instructions to learn how to upgrade.

We would like to express our gratitude to all contributors who have spent their precious time helping improve Yii and made this release possible.

Please note that Yii 1.1 is currently under maintenance mode, which means it will not introduce major new features in the future. We are currently actively developing and maintaining Yii 2.0 which represents a new generation of PHP framework utilizing the latest technologies. 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.

Below we will summarize some of the main enhancements introduced in this release.

Database and ActiveRecord

Database support is evolving constantly in Yii. This time we've added official support for MariaDB and CUBRID databases.

ODBC now could be used in connections via pdo_odbc like the following:

'components'=>array(
    ......
    'db'=>array(
        'class'=>'CDbConnection'
        'driverName'=>'mysql',
        'connectionString'=>'odbc:Driver={MySQL};Server=127.0.0.1;Database=test',
        'username'=>'',
        'password'=>'',
    ),
),

When defining STAT relation one could use scopes:

public function relations()
{
    return array(
        'recentPostCount'=>array(self::STAT,'Post','author_id','scopes'=>'recentScope'),
    );
}

One can specify post-JOIN operations (i.e. use|force|ignore index()) in relational queries like the following:

$users=User::model()->findAll(array(
    'select'=>'t.id,t.name',
    'with'=>array(
        'posts'=>array(
            'alias'=>'p',
            'select'=>'p.id,p.title',
            'joinOptions'=>'USE INDEX(post__user)',
        ),
    ),
));

It's described in detail in "Post-JOIN operations" section of "Relational Active Record" chapter of the guide.

CDbCommand::naturalLeftJoin() and CDbCommand::naturalRightJoin() were added to allow adding corresponding join statements to the command.

It is now possible to override the models PK using primaryKey() method, even if the table defines one.

Files

CFileHelper got new methods:

  • createDirectory() - creates directory recursively setting permissions.
  • getExtensionByMimeType() - determines the file extension name based on its MIME type.

Mime-Type detection itself was improved by using the mime.types file from Apache HTTP project.

CFileHelper::removeDirectory() now properly works with symlinked directories. It could be turned off by specifying traverseSymlinks as false in options array.

CFileHelper::findFiles() got new option named absolutePaths. Method returns absolute paths if the option is set to true or relative ones otherwise. Default value is true.

CFileCache got cachePathMode and cacheFileMode properties that could be used to chmod() these.

Upgrades

Multiple libraries we're using in the framework were updated:

  • jQuery to 1.11.1.
  • jQuery UI to 1.11.2.
  • Multifile plugin used by CMultiFileUpload to 1.48.
  • HTMLPurifier to 4.6.0.
  • i18n data bundled with the framework to CLDR23.1. This adds new locales and has many fixes and additional data for existing ones.

HTML5

When we've first released Yii 1.1 XHTML was the thing. Now it's HTML5 so we've decided to update default application template generated by yiic webapp to use HTML5.

CHtml and CActiveForm got support for HTML5 inputs such as color, datetime, datetime-local, week and search.

Compatibility

Various third party tools and libraries often used with Yii were updated so framework got updates to support these.

  • CApcCache is now compatible with APCu.
  • Yii::import() and Yii::createComponent() are now able to use third party autoloader such as Composer.
  • Yii and YiiBase were added to composer.json autoloading.
  • PHPUnit 3.8+ now could be used.

Request

Request now properly reacts when there's X-HTTP-Method-Override header used to emulate various request types via POST.

There are getIsPatchRequest(), getIsPatchViaPostRequest() and getPatch() methods allowing you to work with HTTP PATCH requests.

Framework now responds with HTTP protocol version passed in request.

Request::getPreferredLanguage() is now able to select a best matching between supported and requested languages.

Error handling

Error handling got several improvements.

  • You can now access exception object via ErrorHandler::getException(). It allows passing to various third party APIs efficiently.
  • Syslog log route is now available out of the box.
  • CClientScript now throws exception in case you're trying to register package that doesn't exist.
  • CActiveForm::$clientOptions got errorCallback so you can hook to clientside validation process using it.

Others

  • Web services got support for SOAP headers and document/literal encoding.
  • CJSON can now use JsonSerializable interface when serializing objects.
  • CHtml::beginForm() now supports additional HTTP methods, via a hidden _method field.
  • CPasswordHelper::generateSalt() now returns salt with $2y$ cost.
  • CFormatter is now able to format DateTime instances.

Tags

release