Skip to content

Commit

Permalink
Serializer#normalize gives precedence to objects that support normali…
Browse files Browse the repository at this point in the history
…zation
  • Loading branch information
ericclemmons committed Nov 8, 2011
1 parent 9e6ba9a commit d789f94
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Symfony/Component/Serializer/Serializer.php
Expand Up @@ -96,6 +96,9 @@ public function normalize($data, $format = null)
if (null === $data || is_scalar($data)) {
return $data;
}
if (is_object($data) && $this->supportsNormalization($data, $format)) {
return $this->normalizeObject($data, $format);
}
if ($data instanceof \Traversable) {
$normalized = array();
foreach ($data as $key => $val) {
Expand Down

0 comments on commit d789f94

Please sign in to comment.