@@ -754,7 +754,7 @@ protected function getAttributeValue(object $object, string $attribute, ?string
754754 && ($ className = $ collectionValueType ->getClassName ())
755755 && $ this ->resourceClassResolver ->isResourceClass ($ className )
756756 ) {
757- $ childContext = $ this ->createChildContext ($ this ->createOperationContext ($ context , $ className ), $ attribute , $ format );
757+ $ childContext = $ this ->createChildContext ($ this ->createOperationContext ($ context , $ className, $ propertyMetadata ), $ attribute , $ format );
758758
759759 // @see ApiPlatform\Hal\Serializer\ItemNormalizer:getComponents logic for intentional duplicate content
760760 // @see ApiPlatform\JsonApi\Serializer\ItemNormalizer:getComponents logic for intentional duplicate content
@@ -791,7 +791,7 @@ protected function getAttributeValue(object $object, string $attribute, ?string
791791 ($ className = $ type ->getClassName ())
792792 && $ this ->resourceClassResolver ->isResourceClass ($ className )
793793 ) {
794- $ childContext = $ this ->createChildContext ($ this ->createOperationContext ($ context , $ className ), $ attribute , $ format );
794+ $ childContext = $ this ->createChildContext ($ this ->createOperationContext ($ context , $ className, $ propertyMetadata ), $ attribute , $ format );
795795 unset($ childContext ['iri ' ], $ childContext ['uri_variables ' ], $ childContext ['item_uri_template ' ]);
796796 if ('jsonld ' === $ format && $ uriTemplate = $ propertyMetadata ->getUriTemplate ()) {
797797 $ operation = $ this ->resourceMetadataCollectionFactory ->create ($ className )->getOperation (
@@ -833,21 +833,19 @@ protected function getAttributeValue(object $object, string $attribute, ?string
833833
834834 // Anonymous resources
835835 if ($ className ) {
836- $ childContext = $ this ->createChildContext ($ this ->createOperationContext ($ context , $ className ), $ attribute , $ format );
837- $ childContext ['output ' ]['gen_id ' ] = $ propertyMetadata ->getGenId () ?? true ;
838-
836+ $ childContext = $ this ->createChildContext ($ this ->createOperationContext ($ context , $ className , $ propertyMetadata ), $ attribute , $ format );
839837 $ attributeValue = $ this ->propertyAccessor ->getValue ($ object , $ attribute );
840838
841839 return $ this ->serializer ->normalize ($ attributeValue , $ format , $ childContext );
842840 }
843841
844842 if ('array ' === $ type ->getBuiltinType ()) {
845843 if ($ className = ($ type ->getCollectionValueTypes ()[0 ] ?? null )?->getClassName()) {
846- $ context = $ this ->createOperationContext ($ context , $ className );
844+ $ context = $ this ->createOperationContext ($ context , $ className, $ propertyMetadata );
847845 }
848846
849847 $ childContext = $ this ->createChildContext ($ context , $ attribute , $ format );
850- $ childContext ['output ' ]['gen_id ' ] = $ propertyMetadata ->getGenId () ?? true ;
848+ $ childContext ['output ' ]['gen_id ' ] ?? = $ propertyMetadata ->getGenId () ?? true ;
851849
852850 $ attributeValue = $ this ->propertyAccessor ->getValue ($ object , $ attribute );
853851
0 commit comments