public function setLanguageDatabase(string $language) : bool
    {
        $pdo = $this->bot->getPDO();

        // Update the language in the database
        $sth = $pdo->prepare('UPDATE ' . $this->user_table . ' SET language = :language WHERE '
                                             . $this->id_column . ' = :id');
        $sth->bindParam(':language', $language);

        $chat_id = $this->bot->chat_id;
        $sth->bindParam(':id', $chat_id);

        try {
            $sth->execute();
        } catch (\PDOException $e) {
            throw new BotException($e->getMessage());
        }

        $this->language = $language;

        return true;
    }
public function setLanguageDatabase(string $language) : bool
    {
        $pdo = $this->bot->getPDO();

        // Update the language in the database
        $sth = $pdo->prepare('UPDATE ' . $this->user_table . ' SET language = :language WHERE '
                                             . $this->id_column . ' = :id');
        $sth->bindParam(':language', $language);

        $chat_id = $this->bot->chat_id;
        $sth->bindParam(':id', $chat_id);

        try {
            $sth->execute();
        } catch (\PDOException $e) {
            throw new BotException($e->getMessage());
        }

        $this->language = $language;

        return true;
    }
public function setLanguageDatabase ( string $ language ) : bool { $ pdo = $ this -> bot -> getPDO ( ) ; // Update the language in the database $ sth = $ pdo -> prepare ( 'UPDATE ' . $ this -> user_table . ' SET language = :language WHERE ' . $ this -> id_column . ' = :id' ) ; $ sth -> bindParam ( ':language' , $ language ) ; $ chat_id = $ this -> bot -> chat_id ; $ sth -> bindParam ( ':id' , $ chat_id ) ; try { $ sth -> execute ( ) ; } catch ( \ PDOException $ e ) { throw new BotException ( $ e -> getMessage ( ) ) ; } $ this -> language = $ language ; return true ; }
\brief Set the current user language in database and internally.
\details Save it into database first.
@param string $language The language to set.
@return bool On sucess, return true, throws exception otherwise.
\ brief Set the current user language in database and internally . \ details Save it into database first .