public final function get_record_snapshot($tablename, $id) {
        global $DB;

        if ($this->restored) {
            throw new \coding_exception('It is not possible to get snapshots from restored events');
        }

        if (isset($this->recordsnapshots[$tablename][$id])) {
            return clone($this->recordsnapshots[$tablename][$id]);
        }

        $record = $DB->get_record($tablename, array('id'=>$id));
        $this->recordsnapshots[$tablename][$id] = $record;

        return $record;
    }
public final function get_record_snapshot($tablename, $id) {
        global $DB;

        if ($this->restored) {
            throw new \coding_exception('It is not possible to get snapshots from restored events');
        }

        if (isset($this->recordsnapshots[$tablename][$id])) {
            return clone($this->recordsnapshots[$tablename][$id]);
        }

        $record = $DB->get_record($tablename, array('id'=>$id));
        $this->recordsnapshots[$tablename][$id] = $record;

        return $record;
    }
public final function get_record_snapshot ( $ tablename , $ id ) { global $ DB ; if ( $ this -> restored ) { throw new \ coding_exception ( 'It is not possible to get snapshots from restored events' ) ; } if ( isset ( $ this -> recordsnapshots [ $ tablename ] [ $ id ] ) ) { return clone ( $ this -> recordsnapshots [ $ tablename ] [ $ id ] ) ; } $ record = $ DB -> get_record ( $ tablename , array ( 'id' => $ id ) ) ; $ this -> recordsnapshots [ $ tablename ] [ $ id ] = $ record ; return $ record ; }
Returns cached record or fetches data from database if not cached.

@param string $tablename
@param int $id
@return \stdClass

@throws \coding_exception if used after ::restore()
Returns cached record or fetches data from database if not cached .