public function onLogout($userId) { if ((int) $userId < 1) { return; } $user = $this->userDao->findById($userId); $userOnline = $this->userOnlineDao->findByUserId($userId); if ($user === null || $userOnline === null) { return; } $user->setActivityStamp($userOnline->getActivityStamp()); $this->userDao->save($user); $this->userOnlineDao->deleteById($userOnline->getId()); }