Skip to content

Commit

Permalink
fix(serializer): collection denormalization from object linked to doc…
Browse files Browse the repository at this point in the history
…trine entities
  • Loading branch information
nicodmfz committed Jun 1, 2021
1 parent bd11bd0 commit f0702fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Serializer/ItemNormalizer.php
Expand Up @@ -51,6 +51,13 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
*/
public function denormalize($data, $class, $format = null, array $context = [])
{
if (null === $objectToPopulate = $this->extractObjectToPopulate($class, $context, static::OBJECT_TO_POPULATE)) {
$normalizedData = $this->prepareForDenormalization($data);
$class = $this->getClassDiscriminatorResolvedClass($normalizedData, $class);
}
$resourceClass = $this->resourceClassResolver->getResourceClass($objectToPopulate, $class);
$context['api_denormalize'] = true;
$context['resource_class'] = $resourceClass;
// Avoid issues with proxies if we populated the object
if (isset($data['id']) && !isset($context[self::OBJECT_TO_POPULATE])) {
if (isset($context['api_allow_update']) && true !== $context['api_allow_update']) {
Expand Down

0 comments on commit f0702fd

Please sign in to comment.