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

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

Notamment s'ils valent "false".
parent 75eb1cbf
......@@ -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,
......
Markdown is supported
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