public function login($vkId) { $user = new User(); $user->setVkId($vkId); $user->setLastLoginDate(date(Defines::SQL_DATE_TIME_FORMAT)); $this->userDao->createOrUpdate($user); $session = App::getSession(); $session->isLogged = true; $session->user = $user; $session->vkData = $this->vkService->getUser($vkId); return App::isLoggedUser(); }
public function createOrUpdate(User $user) { $usersData = [$user->toArray()]; return $this->db->insertOrUpdateDataSet('users', $usersData, ['lastLoginDate']); }