mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Fix #17886: yii\rest\Serializer serialize arrays
This commit is contained in:
committed by
Alexander Makarov
parent
110199bcfd
commit
ecbafa2e3a
@ -6,6 +6,7 @@ Yii Framework 2 Change Log
|
||||
|
||||
- Bug #17859: Fix loading fixtures under Windows (samdark)
|
||||
- Bug #11945: Fix Schema Builder MySQL column definition order (simialbi)
|
||||
- Bug #17886: yii\rest\Serializer serialize arrays (patacca)
|
||||
- Bug #16334: Serializer support `\JsonSerializable` (germanow)
|
||||
- Bug #17798: Avoid creating folder for stream log targets in `FileTarget` (wapmorgan)
|
||||
- Bug #17850: Update to `ReplaceArrayValue` config exception message (alex-code)
|
||||
|
||||
@ -152,6 +152,12 @@ class Serializer extends Component
|
||||
return $this->serializeModel($data);
|
||||
} elseif ($data instanceof DataProviderInterface) {
|
||||
return $this->serializeDataProvider($data);
|
||||
} elseif (is_array($data)) {
|
||||
$serializedArray = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$serializedArray[$key] = $this->serialize($value);
|
||||
}
|
||||
return $serializedArray;
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
Reference in New Issue
Block a user