public function createDocumentFromSource(
        ObjectIdInterface $source,
        array $properties = [],
        ObjectIdInterface $folderId = null,
        VersioningState $versioningState = null,
        array $policies = [],
        array $addAces = [],
        array $removeAces = []
    ) {
        if (!$source instanceof CmisObjectInterface) {
            $sourceObject = $this->getObject($source);
        } else {
            $sourceObject = $source;
        }

        $type = $sourceObject->getType();
        $secondaryTypes = $sourceObject->getSecondaryTypes();

        if ($secondaryTypes === null) {
            $secondaryTypes = [];
        }

        if (!BaseTypeId::cast($type->getBaseTypeId())->equals(BaseTypeId::CMIS_DOCUMENT)) {
            throw new CmisInvalidArgumentException('Source object must be a document!');
        }

        $objectId = $this->getBinding()->getObjectService()->createDocumentFromSource(
            $this->getRepositoryId(),
            $source->getId(),
            $this->getObjectFactory()->convertProperties(
                $properties,
                $type,
                $secondaryTypes,
                self::$createAndCheckoutUpdatability
            ),
            $folderId === null ? null : $folderId->getId(),
            $versioningState,
            $this->getObjectFactory()->convertPolicies($policies),
            $this->getObjectFactory()->convertAces($addAces),
            $this->getObjectFactory()->convertAces($removeAces),
            null
        );

        if ($objectId === null) {
            return null;
        }

        return $this->createObjectId($objectId);
    }
public function createDocumentFromSource(
        ObjectIdInterface $source,
        array $properties = [],
        ObjectIdInterface $folderId = null,
        VersioningState $versioningState = null,
        array $policies = [],
        array $addAces = [],
        array $removeAces = []
    ) {
        if (!$source instanceof CmisObjectInterface) {
            $sourceObject = $this->getObject($source);
        } else {
            $sourceObject = $source;
        }

        $type = $sourceObject->getType();
        $secondaryTypes = $sourceObject->getSecondaryTypes();

        if ($secondaryTypes === null) {
            $secondaryTypes = [];
        }

        if (!BaseTypeId::cast($type->getBaseTypeId())->equals(BaseTypeId::CMIS_DOCUMENT)) {
            throw new CmisInvalidArgumentException('Source object must be a document!');
        }

        $objectId = $this->getBinding()->getObjectService()->createDocumentFromSource(
            $this->getRepositoryId(),
            $source->getId(),
            $this->getObjectFactory()->convertProperties(
                $properties,
                $type,
                $secondaryTypes,
                self::$createAndCheckoutUpdatability
            ),
            $folderId === null ? null : $folderId->getId(),
            $versioningState,
            $this->getObjectFactory()->convertPolicies($policies),
            $this->getObjectFactory()->convertAces($addAces),
            $this->getObjectFactory()->convertAces($removeAces),
            null
        );

        if ($objectId === null) {
            return null;
        }

        return $this->createObjectId($objectId);
    }
public function createDocumentFromSource ( ObjectIdInterface $ source , array $ properties = [ ] , ObjectIdInterface $ folderId = null , VersioningState $ versioningState = null , array $ policies = [ ] , array $ addAces = [ ] , array $ removeAces = [ ] ) { if ( ! $ source instanceof CmisObjectInterface ) { $ sourceObject = $ this -> getObject ( $ source ) ; } else { $ sourceObject = $ source ; } $ type = $ sourceObject -> getType ( ) ; $ secondaryTypes = $ sourceObject -> getSecondaryTypes ( ) ; if ( $ secondaryTypes === null ) { $ secondaryTypes = [ ] ; } if ( ! BaseTypeId :: cast ( $ type -> getBaseTypeId ( ) ) -> equals ( BaseTypeId :: CMIS_DOCUMENT ) ) { throw new CmisInvalidArgumentException ( 'Source object must be a document!' ) ; } $ objectId = $ this -> getBinding ( ) -> getObjectService ( ) -> createDocumentFromSource ( $ this -> getRepositoryId ( ) , $ source -> getId ( ) , $ this -> getObjectFactory ( ) -> convertProperties ( $ properties , $ type , $ secondaryTypes , self :: $ createAndCheckoutUpdatability ) , $ folderId === null ? null : $ folderId -> getId ( ) , $ versioningState , $ this -> getObjectFactory ( ) -> convertPolicies ( $ policies ) , $ this -> getObjectFactory ( ) -> convertAces ( $ addAces ) , $ this -> getObjectFactory ( ) -> convertAces ( $ removeAces ) , null ) ; if ( $ objectId === null ) { return null ; } return $ this -> createObjectId ( $ objectId ) ; }
Creates a new document from a source document.

@param ObjectIdInterface $source The identifier for the source document.
@param string[] $properties The property values that MUST be applied to the object. This list of properties
SHOULD only contain properties whose values differ from the source document.
@param ObjectIdInterface|null $folderId If specified, the identifier for the folder that MUST be the parent
folder for the newly-created document object. This parameter MUST be specified if the repository does NOT
support the optional "unfiling" capability.
@param VersioningState|null $versioningState An enumeration specifying what the versioning state of the
newly-created object MUST be. Valid values are:
<code>none</code>
(default, if the object-type is not versionable) The document MUST be created as a non-versionable
document.
<code>checkedout</code>
The document MUST be created in the checked-out state. The checked-out document MAY be
visible to other users.
<code>major</code>
(default, if the object-type is versionable) The document MUST be created as a major version.
<code>minor</code>
The document MUST be created as a minor version.
@param PolicyInterface[] $policies A list of policy ids that MUST be applied to the newly-created
document object.
@param AceInterface[] $addAces A list of ACEs that MUST be added to the newly-created document object,
either using the ACL from folderId if specified, or being applied if no folderId is specified.
@param AceInterface[] $removeAces A list of ACEs that MUST be removed from the newly-created document
object, either using the ACL from folderId if specified, or being ignored if no folderId is specified.
@return ObjectIdInterface|null the object ID of the new document or <code>null</code> if the document could not
be created.
@throws CmisInvalidArgumentException Throws an <code>CmisInvalidArgumentException</code> if empty
property list is given
Creates a new document from a source document .