src/Versioned.php
public function rollbackSingle($version)
    {
        // Validate $version and safely cast
        if (isset($version) && !is_numeric($version) && $version !== self::LIVE) {
            throw new InvalidArgumentException("Invalid rollback source version $version");
        }
        if (isset($version) && is_numeric($version)) {
            $version = (int)$version;
        }
        // Copy version between stage
        $owner = $this->owner;
        $owner->invokeWithExtensions('onBeforeRollbackSingle', $version);
        $owner->copyVersionToStage($version, self::DRAFT);
        $owner->invokeWithExtensions('onAfterRollbackSingle', $version);
    }
public function rollbackSingle($version)
    {
        // Validate $version and safely cast
        if (isset($version) && !is_numeric($version) && $version !== self::LIVE) {
            throw new InvalidArgumentException("Invalid rollback source version $version");
        }
        if (isset($version) && is_numeric($version)) {
            $version = (int)$version;
        }
        // Copy version between stage
        $owner = $this->owner;
        $owner->invokeWithExtensions('onBeforeRollbackSingle', $version);
        $owner->copyVersionToStage($version, self::DRAFT);
        $owner->invokeWithExtensions('onAfterRollbackSingle', $version);
    }
public function rollbackSingle ( $ version ) { // Validate $version and safely cast if ( isset ( $ version ) && ! is_numeric ( $ version ) && $ version !== self :: LIVE ) { throw new InvalidArgumentException ( "Invalid rollback source version $version" ) ; } if ( isset ( $ version ) && is_numeric ( $ version ) ) { $ version = ( int ) $ version ; } // Copy version between stage $ owner = $ this -> owner ; $ owner -> invokeWithExtensions ( 'onBeforeRollbackSingle' , $ version ) ; $ owner -> copyVersionToStage ( $ version , self :: DRAFT ) ; $ owner -> invokeWithExtensions ( 'onAfterRollbackSingle' , $ version ) ; }
Rollback draft to a given version

@param int|string|null $version Version ID or Versioned::LIVE to rollback from live.
Null to rollback current owner object.
Rollback draft to a given version