src/ChangeSetItem.php
public function canPublish($member = null)
    {
        // No action for unversiond objects so no action to deny
        // Implicitly added items allow publish
        if (!$this->isVersioned() || $this->Added === self::IMPLICITLY) {
            return true;
        }

        // Check canMethod to invoke on object
        switch ($this->getChangeType()) {
            case static::CHANGE_DELETED: {
                /** @var Versioned|DataObject $object */
                $object = Versioned::get_by_stage($this->ObjectClass, Versioned::LIVE)->byID($this->ObjectID);
                if ($object) {
                    return $object->canUnpublish($member);
                }
                break;
            }
            default: {
                /** @var Versioned|DataObject $object */
                $object = Versioned::get_by_stage($this->ObjectClass, Versioned::DRAFT)->byID($this->ObjectID);
                if ($object) {
                    return $object->canPublish($member);
                }
                break;
            }
        }

        return true;
    }
public function canPublish($member = null)
    {
        // No action for unversiond objects so no action to deny
        // Implicitly added items allow publish
        if (!$this->isVersioned() || $this->Added === self::IMPLICITLY) {
            return true;
        }

        // Check canMethod to invoke on object
        switch ($this->getChangeType()) {
            case static::CHANGE_DELETED: {
                /** @var Versioned|DataObject $object */
                $object = Versioned::get_by_stage($this->ObjectClass, Versioned::LIVE)->byID($this->ObjectID);
                if ($object) {
                    return $object->canUnpublish($member);
                }
                break;
            }
            default: {
                /** @var Versioned|DataObject $object */
                $object = Versioned::get_by_stage($this->ObjectClass, Versioned::DRAFT)->byID($this->ObjectID);
                if ($object) {
                    return $object->canPublish($member);
                }
                break;
            }
        }

        return true;
    }
public function canPublish ( $ member = null ) { // No action for unversiond objects so no action to deny // Implicitly added items allow publish if ( ! $ this -> isVersioned ( ) || $ this -> Added === self :: IMPLICITLY ) { return true ; } // Check canMethod to invoke on object switch ( $ this -> getChangeType ( ) ) { case static :: CHANGE_DELETED : { /** @var Versioned|DataObject $object */ $ object = Versioned :: get_by_stage ( $ this -> ObjectClass , Versioned :: LIVE ) -> byID ( $ this -> ObjectID ) ; if ( $ object ) { return $ object -> canUnpublish ( $ member ) ; } break ; } default : { /** @var Versioned|DataObject $object */ $ object = Versioned :: get_by_stage ( $ this -> ObjectClass , Versioned :: DRAFT ) -> byID ( $ this -> ObjectID ) ; if ( $ object ) { return $ object -> canPublish ( $ member ) ; } break ; } } return true ; }
Check if this ChangeSetItem can be published

@param Member $member
@return bool
Check if this ChangeSetItem can be published