src/ChangeSetItem.php
protected function getObjectInStage($stage)
    {
        if (!class_exists($this->ObjectClass)) {
            throw new UnexpectedDataException("Invalid Class '{$this->ObjectClass}' in ChangeSetItem #{$this->ID}");
        }

        // Ignore stage for unversioned objects
        if (!$this->isVersioned()) {
            return DataObject::get_by_id($this->ObjectClass, $this->ObjectID);
        }

        // Get versioned object
        return Versioned::get_by_stage($this->ObjectClass, $stage)->byID($this->ObjectID);
    }
protected function getObjectInStage($stage)
    {
        if (!class_exists($this->ObjectClass)) {
            throw new UnexpectedDataException("Invalid Class '{$this->ObjectClass}' in ChangeSetItem #{$this->ID}");
        }

        // Ignore stage for unversioned objects
        if (!$this->isVersioned()) {
            return DataObject::get_by_id($this->ObjectClass, $this->ObjectID);
        }

        // Get versioned object
        return Versioned::get_by_stage($this->ObjectClass, $stage)->byID($this->ObjectID);
    }
protected function getObjectInStage ( $ stage ) { if ( ! class_exists ( $ this -> ObjectClass ) ) { throw new UnexpectedDataException ( "Invalid Class '{$this->ObjectClass}' in ChangeSetItem #{$this->ID}" ) ; } // Ignore stage for unversioned objects if ( ! $ this -> isVersioned ( ) ) { return DataObject :: get_by_id ( $ this -> ObjectClass , $ this -> ObjectID ) ; } // Get versioned object return Versioned :: get_by_stage ( $ this -> ObjectClass , $ stage ) -> byID ( $ this -> ObjectID ) ; }
Find version of this object in the given stage.
If the object isn't versioned it will return the normal record.

@param string $stage
@return DataObject|Versioned|RecursivePublishable Object in this stage (may not be Versioned)
@throws UnexpectedDataException
Find version of this object in the given stage . If the object isn t versioned it will return the normal record .