src/Serializer/LogoNormalizer.php line 24
<?phpnamespace App\Serializer;use App\Entity\Empresa;use Vich\UploaderBundle\Storage\StorageInterface;use Symfony\Component\Serializer\Normalizer\NormalizerInterface;use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;final class LogoNormalizer implements NormalizerInterface, NormalizerAwareInterface{use NormalizerAwareTrait;/*** @var string*/private const ALREADY_CALLED = 'LOGO_NORMALIZER_ALREADY_CALLED';public function __construct(private StorageInterface $storage){}public function normalize($object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null{$context[self::ALREADY_CALLED] = true;$object->setContentUrl($this->storage->resolveUri($object, 'logo'));return $this->normalizer->normalize($object, $format, $context);}public function supportsNormalization($data, ?string $format = null, array $context = []): bool{if (isset($context[self::ALREADY_CALLED])) {return false;}return $data instanceof Empresa;}}