minor #15311 [Serializer] Simplify AbstractNormalizer::prepareForDenormalization() (dunglas)
This PR was merged into the 2.7 branch.
Discussion
----------
[Serializer] Simplify AbstractNormalizer::prepareForDenormalization()
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
72dce30
[Serializer] Simplify AbstractNormalizer::prepareForDenormalization()
This commit is contained in:
commit
4842bfa52b
@ -272,19 +272,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
|
|||||||
*/
|
*/
|
||||||
protected function prepareForDenormalization($data)
|
protected function prepareForDenormalization($data)
|
||||||
{
|
{
|
||||||
if (is_array($data) || is_object($data) && $data instanceof \ArrayAccess) {
|
return (array) $data;
|
||||||
$normalizedData = $data;
|
|
||||||
} elseif (is_object($data)) {
|
|
||||||
$normalizedData = array();
|
|
||||||
|
|
||||||
foreach ($data as $attribute => $value) {
|
|
||||||
$normalizedData[$attribute] = $value;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$normalizedData = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $normalizedData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user