public function persist(UserInterface $user)
    {
        $session = new PersistentSession();
        $session->email = $this->email;
        $session->series = $this->hash($this->series);
        $session->token = $this->hash($this->token);
        $session->user_id = $user->id();
        $session->two_factor_verified = $user->isTwoFactorVerified();

        try {
            $session->save();
        } catch (\Exception $e) {
            throw new \Exception("Unable to save persistent session for user # {$user->id()}: ".$e->getMessage());
        }

        return $session;
    }
public function persist(UserInterface $user)
    {
        $session = new PersistentSession();
        $session->email = $this->email;
        $session->series = $this->hash($this->series);
        $session->token = $this->hash($this->token);
        $session->user_id = $user->id();
        $session->two_factor_verified = $user->isTwoFactorVerified();

        try {
            $session->save();
        } catch (\Exception $e) {
            throw new \Exception("Unable to save persistent session for user # {$user->id()}: ".$e->getMessage());
        }

        return $session;
    }
public function persist ( UserInterface $ user ) { $ session = new PersistentSession ( ) ; $ session -> email = $ this -> email ; $ session -> series = $ this -> hash ( $ this -> series ) ; $ session -> token = $ this -> hash ( $ this -> token ) ; $ session -> user_id = $ user -> id ( ) ; $ session -> two_factor_verified = $ user -> isTwoFactorVerified ( ) ; try { $ session -> save ( ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( "Unable to save persistent session for user # {$user->id()}: " . $ e -> getMessage ( ) ) ; } return $ session ; }
Persists this cookie to the database.

@param UserInterface $user

@throws \Exception when the model cannot be saved.

@return PersistentSession
Persists this cookie to the database .