Skip to content

Commit

Permalink
[Serializer] Simplify AbstractNormalizer::prepareForDenormalization()
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jul 19, 2015
1 parent 99f3475 commit 72dce30
Showing 1 changed file with 1 addition and 13 deletions.
Expand Up @@ -272,19 +272,7 @@ protected function getAllowedAttributes($classOrObject, array $context, $attribu
*/
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;
}

/**
Expand Down

0 comments on commit 72dce30

Please sign in to comment.