Skip to content

Commit

Permalink
fix: Restore the use of placeholders named differently than id
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerendir committed Aug 9, 2023
1 parent ebf0310 commit 5ba3217
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Serializer/AbstractItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,12 @@ protected function denormalizeCollection(string $attribute, ApiProperty $propert
$collectionKeyType = $type->getCollectionKeyTypes()[0] ?? null;
$collectionKeyBuiltinType = $collectionKeyType?->getBuiltinType();
$childContext = $this->createChildContext(['resource_class' => $className] + $context, $attribute, $format);
unset($childContext['uri_variables']);
if ($this->resourceMetadataCollectionFactory) {
$childContext['operation'] = $this->resourceMetadataCollectionFactory->create($className)->getOperation();
$lastUriVariable = array_key_exists('uri_variables', $childContext) ? array_key_last($childContext['uri_variables']) : null;
if ('id' === $lastUriVariable) {
unset($childContext['uri_variables']);
if ($this->resourceMetadataCollectionFactory) {
$childContext['operation'] = $this->resourceMetadataCollectionFactory->create($className)->getOperation();
}
}

$values = [];
Expand Down

0 comments on commit 5ba3217

Please sign in to comment.