diff --git a/src/Core/Metadata/Property/Factory/AnnotationSubresourceMetadataFactory.php b/src/Core/Metadata/Property/Factory/AnnotationSubresourceMetadataFactory.php index 998650e51e6..8f17f0922f2 100644 --- a/src/Core/Metadata/Property/Factory/AnnotationSubresourceMetadataFactory.php +++ b/src/Core/Metadata/Property/Factory/AnnotationSubresourceMetadataFactory.php @@ -83,6 +83,10 @@ public function create(string $resourceClass, string $property, array $options = return $this->updateMetadata($attributes[0]->newInstance(), $propertyMetadata, $resourceClass, $property); } + if (!$this->reader) { + return $propertyMetadata; + } + $annotation = $this->reader->getMethodAnnotation($reflectionMethod, ApiSubresource::class); if ($annotation instanceof ApiSubresource) { return $this->updateMetadata($annotation, $propertyMetadata, $resourceClass, $property);