Implement NormalizerInterface::getSupportedTypes().

See https://symfony.com/doc/current/serializer/custom_normalizer.html#improving-performance-of-normalizers-denormalizers
This commit is contained in:
Michael Stenta 2023-10-11 12:32:51 -04:00
parent 81c3cd2ec0
commit 3398eb0170
2 changed files with 18 additions and 0 deletions

View File

@ -128,4 +128,13 @@ class ContentEntityGeometryNormalizer implements NormalizerInterface, Serializer
return $invalid_count === 0;
}
/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array {
return [
GeometryWrapper::class => TRUE,
];
}
}

View File

@ -163,4 +163,13 @@ class KmlNormalizer implements NormalizerInterface, DenormalizerInterface {
return ['name', 'entity_type', 'bundle', 'internal_id', 'description'];
}
/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array {
return [
GeometryWrapper::class => TRUE,
];
}
}