diff --git a/src/php/Metadata/MetadataFactory.php b/src/php/Metadata/MetadataFactory.php index 5c6c372bdb59606cb6c19d3f620d8f508b735f53..4e208e011ff5f22874c15b852f89bdb858206e4e 100644 --- a/src/php/Metadata/MetadataFactory.php +++ b/src/php/Metadata/MetadataFactory.php @@ -253,33 +253,43 @@ final class MetadataFactory implements MetadataFactoryInterface $opDef = new OperationDef($name, $method, $type === OperationType::COLLECTION); - $input = $getAttribute('input', null); - if ($input === null && $opDef->hasNormalization()) { - $input = $class->getFullName(); - } - if (is_array($input) && isset($input['class'])) { - $input = $input['class']; - } - $normalization = $input ? $this->getOperationSerialization( - $opDef, - PHPClass::get($input), - true, - $getAttribute('normalization_context', [])['groups'] ?? [] - ) : null; - $output = $getAttribute('output', null); - if ($input === null && $opDef->hasDenormalization()) { - $output = $class->getFullName(); + $normalization = null; + if ($output !== false) { + if (is_array($output) && isset($output['class'])) { + $output = $output['class']; + } + if ($output === null && $opDef->hasNormalization()) { + $output = $class->getFullName(); + } + if ($output) { + $normalization = $this->getOperationSerialization( + $opDef, + PHPClass::get($output), + true, + $getAttribute('normalization_context', [])['groups'] ?? [] + ); + } } - if (is_array($output) && isset($output['class'])) { - $output = $output['class']; + + $input = $getAttribute('input', null); + $denormalization = null; + if ($input !== false) { + if (is_array($input) && isset($input['class'])) { + $input = $input['class']; + } + if ($input === null && $opDef->hasDenormalization()) { + $input = $class->getFullName(); + } + if ($input) { + $denormalization = $this->getOperationSerialization( + $opDef, + PHPClass::get($input), + false, + $getAttribute('denormalization_context', [])['groups'] ?? [] + ); + } } - $denormalization = $output ? $this->getOperationSerialization( - $opDef, - PHPClass::get($output), - false, - $getAttribute('denormalization_context', [])['groups'] ?? [] - ) : null; return new OperationMetadata( $opDef,