From f37cc05abf697db590c8c288e92261cd0bfa0f41 Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Wed, 22 Oct 2014 23:51:03 +0800 Subject: [PATCH] Fix silly mistake. --- Controllers/UserAuthController.php | 12 +++++------- DataAccess/DataMapper/DataMapper.php | 6 ++---- public_html/index.php | 1 + 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Controllers/UserAuthController.php b/Controllers/UserAuthController.php index 1b66204..c85988a 100644 --- a/Controllers/UserAuthController.php +++ b/Controllers/UserAuthController.php @@ -48,7 +48,7 @@ class UserAuthController implements IDivineController $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. @@ -77,7 +77,7 @@ class UserAuthController implements IDivineController 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()); @@ -86,7 +86,7 @@ class UserAuthController implements IDivineController $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) @@ -94,11 +94,9 @@ class UserAuthController implements IDivineController ->With_Tags(array()) ->With_FacebookId($facebookId) ->build(); - - $newUser->setAuthToken($this->_facebookSession->getToken()); - + $this->_userRepository->save($newUser); - + return $newUser; } diff --git a/DataAccess/DataMapper/DataMapper.php b/DataAccess/DataMapper/DataMapper.php index 2a8c9e6..e37d377 100644 --- a/DataAccess/DataMapper/DataMapper.php +++ b/DataAccess/DataMapper/DataMapper.php @@ -56,21 +56,19 @@ class DataMapper implements IDataMapper public function save(IDivineEntity $entity) { $queries = AbstractPopulationHelper::generateUpdateSaveQuery($this->_maps, $entity, $entity->getId(), $this->_db); - + $flattened = array(); $flattened_tables = array(); foreach($queries as $index => $query) { $this_table = $query['table']; $this_columns = $query['columns']; - $add = false; for($i = $index+1; $i