/** * Given a person (retrieved from the data base), returns an object containing all the data of the person * @param PersonEntity $person * @return mixed */ public static function getFormattedData($person) { $responsePerson = []; /** @var RecordEntity $recentRecord */ $recentRecord = self::getMostRecentRecord($person->getId()); $responsePerson['id'] = $recentRecord->getId(); $responsePerson['given_name'] = $person->getGivenName(); $responsePerson['last_name'] = $person->getLastName(); $responsePerson['phone'] = $recentRecord->findVarchar(FIELD_PHONE); $responsePerson['email'] = $recentRecord->findVarchar(FIELD_EMAIL); return $responsePerson; }