$this->_facebookSession = $this->isSessionLongLived($facebookSession) ? $facebookSession->getLongLivedSession() : $facebookSession;
$this->_facebookRequest = (new FacebookRequest($this->_facebookSession, 'GET', '/me?fields=hometown,first_name,last_name'))->execute();
-
+
$id = $this->_facebookRequest->getGraphObject(GraphUser::className())->getId();
// If the user is not in the DB, create them.
private function registerUser()
{
$userProfile = $this->_facebookRequest->getGraphObject(GraphUser::className());
-
+
$homeTownPageId = $userProfile->getProperty('hometown')->getProperty('id');
$pageRequest = (new FacebookRequest($this->_facebookSession, 'GET', '/' . $homeTownPageId ))->execute();
$pageLocation = $pageRequest->getGraphObject(GraphLocation::className())->getProperty('location')->cast(GraphLocation::className());
$firstName = $userProfile->getFirstName();
$lastName = $userProfile->getLastName();
$facebookId = $userProfile->getId();
-
+
//TODO: Is insantiating the VO classes here a good idea?
$newUser = $this->_userStepByStepBuilder->With_Country(new \Domain\VOs\Country($country))
->With_DisplayName($firstName)
->With_Tags(array())
->With_FacebookId($facebookId)
->build();
-
- $newUser->setAuthToken($this->_facebookSession->getToken());
-
+
$this->_userRepository->save($newUser);
-
+
return $newUser;
}