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:
Fabien Potencier 2015-07-22 09:09:55 +02:00
commit 4842bfa52b
1 changed files with 1 additions and 13 deletions

View File

@ -272,19 +272,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
*/
protected function prepareForDenormalization($data)
{
if (is_array($data) || is_object($data) && $data instanceof \ArrayAccess) {
$normalizedData = $data;
} elseif (is_object($data)) {
$normalizedData = array();
foreach ($data as $attribute => $value) {
$normalizedData[$attribute] = $value;
}
} else {
$normalizedData = array();
}
return $normalizedData;
return (array) $data;
}
/**