src/Offer/Serializer/Normalizer/OfferEmailDraftNormalizer.php line 42
<?phpdeclare(strict_types=1);/*** Copyright (c) 2021 TECLA Consulting Group oü.* All rights reserved.** This unpublished material is proprietary to TECLA Consulting Group oü.* All rights reserved. The methods and* techniques described herein are considered trade secrets* and/or confidential. Reproduction or distribution, in whole* or in part, is forbidden except by express written permission* of TECLA Consulting Group oü.** @author Matúš Sýkorjak <matus@tecla.no>* @copyright 2021 TECLA Consulting Group oü*/namespace App\Offer\Serializer\Normalizer;use App\Core\Serializer\Normalizer\AttributeAwareNormalizerTrait;use App\Offer\Model\OfferEmailDraftInterface;use Symfony\Component\Routing\Generator\UrlGeneratorInterface;use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;use Symfony\Component\Serializer\Normalizer\NormalizerInterface;final class OfferEmailDraftNormalizer implements ContextAwareNormalizerInterface, CacheableSupportsMethodInterface{use AttributeAwareNormalizerTrait;private NormalizerInterface $normalizer;private UrlGeneratorInterface $urlGenerator;public function __construct(NormalizerInterface $normalizer, UrlGeneratorInterface $urlGenerator){$this->normalizer = $normalizer;$this->urlGenerator = $urlGenerator;}public function normalize($object, string $format = null, array $context = []): float|int|bool|\ArrayObject|array|string|null{$data = $this->normalizer->normalize($object, $format, $context);if (true === $this->shouldSerializeAttribute($data, OfferEmailDraftInterface::ATTR__LINKS, $context)) {$this->normalize_Links($object, $data);}return $data;}public function supportsNormalization($data, string $format = null, array $context = []): bool{return $data instanceof OfferEmailDraftInterface;}public function hasCacheableSupportsMethod(): bool{return __CLASS__ === static::class;}private function normalize_Links(OfferEmailDraftInterface $emailDraft, array &$data): void{$data[OfferEmailDraftInterface::ATTR__LINKS] = ['ajax' => ['createAttachment' => $this->urlGenerator->generate('app.offer.ajax.offer_email_draft_attachment.create', ['id' => $emailDraft->getId(),]),],];}}