/** * complete the online-identity with the api json * * @param OnlineIdentity $pOnlineIdentity * @param Object $pObject */ public function completeOnlineIdentity(&$pOnlineIdentity, $pProfileArray, $pUser) { $pOnlineIdentity->setName($pProfileArray['first-name'] . " " . $pProfileArray['last-name']); $pOnlineIdentity->setSocialPublishingEnabled(true); $pOnlineIdentity->setUserId($pUser->getId()); if (isset($pProfileArray['date-of-birth']['year'])) { $pOnlineIdentity->setBirthdate($pProfileArray['date-of-birth']['year'] . '-' . $pProfileArray['date-of-birth']['month'] . '-' . $pProfileArray['date-of-birth']['day']); } $pOnlineIdentity->setLocationRaw($pProfileArray['location']['name']); $pOnlineIdentity->setPhoto($pProfileArray['pictureUrl']); $pOnlineIdentity->save(); // update user's birthdate if it's not set yet and provided by this identity if (is_null($pUser->getBirthdate()) && $pOnlineIdentity->getBirthdate()) { $pUser->setBirthdate($pOnlineIdentity->getBirthdate()); $pUser->save(); } }