Longman\TelegramBot\ConversationDB::insertConversation PHP Method

insertConversation() public static method

Insert the conversation in the database
public static insertConversation ( integer $user_id, integer $chat_id, string $command ) : boolean
$user_id integer
$chat_id integer
$command string
return boolean
    public static function insertConversation($user_id, $chat_id, $command)
    {
        if (!self::isDbConnected()) {
            return false;
        }
        try {
            $sth = self::$pdo->prepare('INSERT INTO `' . TB_CONVERSATION . '`
                (
                `status`, `user_id`, `chat_id`, `command`, `notes`, `created_at`, `updated_at`
                )
                VALUES (
                :status, :user_id, :chat_id, :command, :notes, :date, :date
                )
               ');
            $active = 'active';
            //$notes = json_encode('');
            $notes = '""';
            $created_at = self::getTimestamp();
            $sth->bindParam(':status', $active);
            $sth->bindParam(':command', $command);
            $sth->bindParam(':user_id', $user_id);
            $sth->bindParam(':chat_id', $chat_id);
            $sth->bindParam(':notes', $notes);
            $sth->bindParam(':date', $created_at);
            $status = $sth->execute();
        } catch (Exception $e) {
            throw new TelegramException($e->getMessage());
        }
        return $status;
    }