mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-03 14:06:45 +01:00
Explicitly mark our normalizers as cachabel or not
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user