mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 10:18:56 +02:00
Explicitly mark our normalizers as cachabel or not
This commit is contained in:
parent
b38f49a90e
commit
a1f4b35749
4 changed files with 39 additions and 12 deletions
|
@ -21,12 +21,13 @@
|
|||
namespace App\Serializer;
|
||||
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||
|
||||
class StructuralElementNormalizer implements ContextAwareNormalizerInterface
|
||||
class StructuralElementNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
|
||||
{
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
|
@ -35,7 +36,7 @@ class StructuralElementNormalizer implements ContextAwareNormalizerInterface
|
|||
$this->normalizer = $normalizer;
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, string $format = null, array $context = [])
|
||||
public function supportsNormalization($data, string $format = null): bool
|
||||
{
|
||||
return $data instanceof AbstractStructuralDBElement;
|
||||
}
|
||||
|
@ -57,4 +58,9 @@ class StructuralElementNormalizer implements ContextAwareNormalizerInterface
|
|||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function hasCacheableSupportsMethod(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue