Commit 3af08064 by Alexander Makarov

Fixes #4911: Changed callback signature used in…

Fixes #4911: Changed callback signature used in `yii\base\ArrayableTrait::fields()` from `function ($field, $model) {` to `function ($model, $field) {`
parent f34b138a
......@@ -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 #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 #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: 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)
......
......@@ -206,3 +206,6 @@ new ones save the following code as `convert.php` that should be placed in the s
- `sendContentAsFile($content, $attachmentName, $options = [])`
- `sendStreamAsFile($handle, $attachmentName, $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) {`.
......@@ -35,7 +35,7 @@ trait ArrayableTrait
* returning the corresponding field value. The signature of the callable should be:
*
* ```php
* function ($field, $model) {
* function ($model, $field) {
* // return field value
* }
* ```
......@@ -118,7 +118,7 @@ trait ArrayableTrait
{
$data = [];
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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment