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

Gère correctement les attributs "input" et "output".

Notamment s'ils valent "false".
Showing with 24 additions and 26 deletions
+24 -26
......@@ -253,35 +253,33 @@ final class MetadataFactory implements MetadataFactoryInterface
$opDef = new OperationDef($name, $method, $type === OperationType::COLLECTION);
if ($opDef->hasNormalization()) {
$input = $getAttribute('input', $class->getFullName());
if (is_array($input) && isset($input['class'])) {
$input = $input['class'];
}
$normalization = $this->getOperationSerialization(
$opDef,
PHPClass::get($input),
true,
$getAttribute('normalization_context', [])['groups'] ?? []
);
} else {
$normalization = null;
$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;
if ($opDef->hasDenormalization()) {
$output = $getAttribute('output', $class->getFullName());
if (is_array($output) && isset($output['class'])) {
$output = $output['class'];
}
$denormalization = $this->getOperationSerialization(
$opDef,
PHPClass::get($output),
false,
$getAttribute('denormalization_context', [])['groups'] ?? []
);
} else {
$denormalization = null;
$output = $getAttribute('output', null);
if ($input === null && $opDef->hasDenormalization()) {
$output = $class->getFullName();
}
if (is_array($output) && isset($output['class'])) {
$output = $output['class'];
}
$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