Longman\TelegramBot\DB::insertEditedMessageRequest PHP Method

insertEditedMessageRequest() public static method

Insert Edited Message request in db
public static insertEditedMessageRequest ( Message $edited_message ) : boolean
$edited_message Longman\TelegramBot\Entities\Message
return boolean If the insert was successful
    public static function insertEditedMessageRequest(Message $edited_message)
    {
        if (!self::isDbConnected()) {
            return false;
        }
        $from = $edited_message->getFrom();
        $chat = $edited_message->getChat();
        $chat_id = $chat->getId();
        $edit_date = self::getTimestamp($edited_message->getEditDate());
        $entities = self::entitiesArrayToJson($edited_message->getEntities(), null);
        //Insert chat
        self::insertChat($chat, $edit_date);
        //Insert user and the relation with the chat
        if (is_object($from)) {
            self::insertUser($from, $edit_date, $chat);
        }
        try {
            $sth = self::$pdo->prepare('
                INSERT IGNORE INTO `' . TB_EDITED_MESSAGE . '`
                (`chat_id`, `message_id`, `user_id`, `edit_date`, `text`, `entities`, `caption`)
                VALUES
                (:chat_id, :message_id, :user_id, :date, :text, :entities, :caption)
            ');
            $message_id = $edited_message->getMessageId();
            if (is_object($from)) {
                $from_id = $from->getId();
            } else {
                $from_id = null;
            }
            $text = $edited_message->getText();
            $caption = $edited_message->getCaption();
            $sth->bindParam(':chat_id', $chat_id, PDO::PARAM_INT);
            $sth->bindParam(':message_id', $message_id, PDO::PARAM_INT);
            $sth->bindParam(':user_id', $from_id, PDO::PARAM_INT);
            $sth->bindParam(':date', $edit_date, PDO::PARAM_STR);
            $sth->bindParam(':text', $text, PDO::PARAM_STR);
            $sth->bindParam(':entities', $entities, PDO::PARAM_STR);
            $sth->bindParam(':caption', $caption, PDO::PARAM_STR);
            return $sth->execute();
        } catch (PDOException $e) {
            throw new TelegramException($e->getMessage());
        }
    }