Fixes #4911: Changed callback signature used in yii\base\ArrayableTrait::fields() from function ($field, $model) { to function ($model, $field) {

This commit is contained in:
Alexander Makarov
2014-09-04 00:35:23 +04:00
parent f34b138aab
commit 3af08064b8
3 changed files with 6 additions and 2 deletions

View File

@ -247,6 +247,7 @@ Yii Framework 2 Change Log
- Chg #4586: Signed bigint and unsigned int will be converted into integers when they are loaded from DB by AR (qiangxue) - Chg #4586: Signed bigint and unsigned int will be converted into integers when they are loaded from DB by AR (qiangxue)
- Chg #4591: `yii\helpers\Url::to()` will no longer prefix relative URLs with the base URL (qiangxue) - Chg #4591: `yii\helpers\Url::to()` will no longer prefix relative URLs with the base URL (qiangxue)
- Chg #4595: `yii\widgets\LinkPager`'s `nextPageLabel`, `prevPageLabel`, `firstPageLabel`, `lastPageLabel` are now taking `false` instead of `null` for "no label" (samdark) - Chg #4595: `yii\widgets\LinkPager`'s `nextPageLabel`, `prevPageLabel`, `firstPageLabel`, `lastPageLabel` are now taking `false` instead of `null` for "no label" (samdark)
- Chg #4911: Changed callback signature used in `yii\base\ArrayableTrait::fields()` from `function ($field, $model) {` to `function ($model, $field) {` (samdark)
- Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue) - Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
- Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue) - Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue)
- Chg: `yii\grid\DataColumn::getDataCellValue()` visibility is now `public` to allow accessing the value from a GridView directly (cebe) - Chg: `yii\grid\DataColumn::getDataCellValue()` visibility is now `public` to allow accessing the value from a GridView directly (cebe)

View File

@ -206,3 +206,6 @@ new ones save the following code as `convert.php` that should be placed in the s
- `sendContentAsFile($content, $attachmentName, $options = [])` - `sendContentAsFile($content, $attachmentName, $options = [])`
- `sendStreamAsFile($handle, $attachmentName, $options = [])` - `sendStreamAsFile($handle, $attachmentName, $options = [])`
- `xSendFile($filePath, $attachmentName = null, $options = [])` - `xSendFile($filePath, $attachmentName = null, $options = [])`
* The signature of callbacks used in `yii\base\ArrayableTrait::fields()` is changed from `function ($field, $model) {`
to `function ($model, $field) {`.

View File

@ -35,7 +35,7 @@ trait ArrayableTrait
* returning the corresponding field value. The signature of the callable should be: * returning the corresponding field value. The signature of the callable should be:
* *
* ```php * ```php
* function ($field, $model) { * function ($model, $field) {
* // return field value * // return field value
* } * }
* ``` * ```
@ -118,7 +118,7 @@ trait ArrayableTrait
{ {
$data = []; $data = [];
foreach ($this->resolveFields($fields, $expand) as $field => $definition) { foreach ($this->resolveFields($fields, $expand) as $field => $definition) {
$data[$field] = is_string($definition) ? $this->$definition : call_user_func($definition, $field, $this); $data[$field] = is_string($definition) ? $this->$definition : call_user_func($definition, $this, $field);
} }
if ($this instanceof Linkable) { if ($this instanceof Linkable) {