src/Data/DefaultDataProvider.php
protected function insertUndo($sourceSQL, $saveSQL, $table)
    {
        // Load row.
        $statement = $this->connection->query($saveSQL);

        // Check if we have a result.
        if (0 === $statement->rowCount()) {
            return;
        }

        $result = $statement->fetch(\PDO::FETCH_ASSOC);

        // Save information in array.
        $parameters = [];
        foreach ($result as $value) {
            $parameters[$table][] = $value;
        }

        $prefix = '<span style="color:#b3b3b3; padding-right:3px;">(DC General)</span>';
        $user   = BackendUser::getInstance();

        // Write into undo.
        $this->connection->insert(
            'tl_undo',
            [
                'tl_undo.pid'          => $user->id,
                'tl_undo.tstamp'       => \time(),
                'tl_undo.fromTable'    => $table,
                'tl_undo.query'        => $prefix . $sourceSQL,
                'tl_undo.affectedRows' => \count($parameters[$table]),
                'tl_undo.data'         => \serialize($parameters)
            ]
        );
    }
protected function insertUndo($sourceSQL, $saveSQL, $table)
    {
        // Load row.
        $statement = $this->connection->query($saveSQL);

        // Check if we have a result.
        if (0 === $statement->rowCount()) {
            return;
        }

        $result = $statement->fetch(\PDO::FETCH_ASSOC);

        // Save information in array.
        $parameters = [];
        foreach ($result as $value) {
            $parameters[$table][] = $value;
        }

        $prefix = '<span style="color:#b3b3b3; padding-right:3px;">(DC General)</span>';
        $user   = BackendUser::getInstance();

        // Write into undo.
        $this->connection->insert(
            'tl_undo',
            [
                'tl_undo.pid'          => $user->id,
                'tl_undo.tstamp'       => \time(),
                'tl_undo.fromTable'    => $table,
                'tl_undo.query'        => $prefix . $sourceSQL,
                'tl_undo.affectedRows' => \count($parameters[$table]),
                'tl_undo.data'         => \serialize($parameters)
            ]
        );
    }
protected function insertUndo ( $ sourceSQL , $ saveSQL , $ table ) { // Load row. $ statement = $ this -> connection -> query ( $ saveSQL ) ; // Check if we have a result. if ( 0 === $ statement -> rowCount ( ) ) { return ; } $ result = $ statement -> fetch ( \ PDO :: FETCH_ASSOC ) ; // Save information in array. $ parameters = [ ] ; foreach ( $ result as $ value ) { $ parameters [ $ table ] [ ] = $ value ; } $ prefix = '<span style="color:#b3b3b3; padding-right:3px;">(DC General)</span>' ; $ user = BackendUser :: getInstance ( ) ; // Write into undo. $ this -> connection -> insert ( 'tl_undo' , [ 'tl_undo.pid' => $ user -> id , 'tl_undo.tstamp' => \ time ( ) , 'tl_undo.fromTable' => $ table , 'tl_undo.query' => $ prefix . $ sourceSQL , 'tl_undo.affectedRows' => \ count ( $ parameters [ $ table ] ) , 'tl_undo.data' => \ serialize ( $ parameters ) ] ) ; }
Store an undo entry in the table tl_undo.

Currently this only supports delete queries.

@param string $sourceSQL The SQL used to perform the action to be undone.
@param string $saveSQL   The SQL query to retrieve the current entries.
@param string $table     The table to be affected by the action.

@return void
Store an undo entry in the table tl_undo .