/** * {@inheritdoc} * * @VirtualProperty */ public function getTitle() { return $this->entity->getFullName(); }
/** * Takes a contact entity and a locale and returns the api object. * * @param Contact $contact * @param string $locale * * @return ContactApi */ protected function getApiObject($contact, $locale) { $apiObject = new ContactApi($contact, $locale); if ($contact->getAvatar()) { $apiAvatar = $this->mediaManager->getById($contact->getAvatar()->getId(), $locale); $apiObject->setAvatar($apiAvatar); } return $apiObject; }
private function serialize(Contact $contact) { $tags = []; foreach ($contact->getTags() as $tag) { $tags[] = $tag->getName(); } return ['formOfAddress' => $contact->getFormOfAddress(), 'title' => $contact->getTitle(), 'salutation' => $contact->getSalutation(), 'fullName' => $contact->getFullName(), 'firstName' => $contact->getFirstName(), 'lastName' => $contact->getLastName(), 'middleName' => $contact->getMiddleName(), 'birthday' => $contact->getBirthday(), 'created' => $contact->getCreated(), 'changed' => $contact->getChanged(), 'medias' => $contact->getMedias(), 'emails' => [], 'phones' => [], 'faxes' => [], 'urls' => [], 'tags' => $tags, 'categories' => []]; }