Пример #1
0
 /**
  * @param UserInterface|User $user
  * @param UserResponseInterface $response
  */
 public function connect(UserInterface $user, UserResponseInterface $response)
 {
     /** @var User $previousUser */
     $previousUser = $this->userManager->findUserBy(['slackUserName' => $response->getUsername()]);
     if ($previousUser !== null) {
         $previousUser->setSlackUserName(null);
         $previousUser->setSlackAccessToken(null);
         $this->userManager->updateUser($previousUser);
     }
     $user->setSlackUserName($response->getUsername());
     $user->setSlackAccessToken($response->getAccessToken());
     $this->userManager->updateUser($user);
 }