2.5 KiB
Upgrading Instructions for Yii Framework v2
!!!IMPORTANT!!!
The following upgrading instructions are cumulative. That is, if you want to upgrade from version A to version C and there is version B between A and C, you need to following the instructions for both A and B.
Upgrade from Yii 2.0 Beta
-
If you used
clearAll()orclearAllAssignments()ofyii\rbac\DbManager, you should replace them withremoveAll()andremoveAllAssignments()respectively. -
If you created RBAC rule classes, you should modify their
execute()method by adding$useras the first parameter:execute($user, $item, $params). The$userparameter represents the ID of the user currently being access checked. Previously, this is passed via$params['user']. -
If you override
yii\grid\DataColumn::getDataCellValue()with visibilityprotectedyou have to change visibility topublicas visibility of the base method has changed. -
If you have classes implementing
yii\web\IdentityInterface(very common), you should modify the signature offindIdentityByAccessToken()aspublic static function findIdentityByAccessToken($token, $type = null). The new$typeparameter will contain the type information about the access token. For example, if you useyii\filters\auth\HttpBearerAuthauthentication method, the value of this parameter will beyii\filters\auth\HttpBearerAuth. This allows you to differentiate access tokens taken by different authentication methods. -
If you are sharing the same cache across different applications, you should configure the
keyPrefixproperty of the cache component to use some unique string. Previously, this property was automatically assigned with a unique string. -
If you are using
dropDownList(),listBox(),activeDropDownList(), oractiveListBox()ofyii\helpers\Html, and your list options use multiple blank spaces to format and align option label texts, you need to specify the optionencodeSpacesto be true. -
If you are using
yii\grid\GridViewand have configured a data column to use a PHP callable to return cell values (viayii\grid\DataColumn::value), you may need to adjust the signature of the callable to befunction ($model, $key, $index, $widget). The$keyparameter was newly added in this release. -
yii\console\controllers\AssetControlleris now using hashes instead of timestamps. Replace all{ts}with{hash}.