thirdPartyRender = $thirdPartyRender; } /** * @param ThirdParty $thirdParty */ public function normalize($thirdParty, ?string $format = null, array $context = []) { return [ 'type' => 'thirdparty', 'text' => $this->thirdPartyRender->renderString($thirdParty, []), 'id' => $thirdParty->getId(), 'kind' => $thirdParty->getKind(), 'address' => $this->normalizer->normalize($thirdParty->getAddress(), $format, ['address_rendering' => 'short']), 'phonenumber' => $thirdParty->getTelephone(), 'email' => $thirdParty->getEmail(), 'isChild' => $thirdParty->isChild(), 'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context), 'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context), 'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(), 'comment' => $thirdParty->getComment(), ]; } public function supportsNormalization($data, ?string $format = null) { return $data instanceof ThirdParty; } }