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