Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b643481

Browse files
committed
minor #44001 [Serializer] Return unique attributes in PropertyNormalizer extractAttributes function (satalaondrej)
This PR was submitted for the 5.4 branch but it was merged into the 4.4 branch instead. Discussion ---------- [Serializer] Return unique attributes in PropertyNormalizer extractAttributes function | Q | A | ------------- | --- | Branch? | 5.4 <!-- see below --> | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | - <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | - <!-- required for new features --> The `extractAttributes` function in `PropertyNormalizer` was improved to return only unique attributes in cases (e.g. when parent class has the same property as child class which we are normalazing) when unnecessary duplicate attributes could be returned. Commits ------- c6d1a6f [Serializer] PropertyNormalizer - return unique (i.e. filter duplicate ) attributes in extractAttributes function
2 parents 17e5244 + c6d1a6f commit b643481

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected function extractAttributes($object, $format = null, array $context = [
119119
}
120120
} while ($reflectionObject = $reflectionObject->getParentClass());
121121

122-
return $attributes;
122+
return array_unique($attributes);
123123
}
124124

125125
/**

0 commit comments

Comments
 (0)