Commit 9422cc38 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Utilisation correcte des attributs "input" et "output".

Showing with 34 additions and 24 deletions
+34 -24
......@@ -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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment