/**
  * Constructor of the object type. This constructor MUST set the session property to the given session and
  * call the <code>self::populate</code> method with the given <code>$typeDefinition</code>
  *
  * @param SessionInterface $session
  * @param DocumentTypeDefinitionInterface $typeDefinition
  * @throws CmisInvalidArgumentException Throws exception if invalid type definition is given
  */
 public function __construct(SessionInterface $session, TypeDefinitionInterface $typeDefinition)
 {
     if (!$typeDefinition instanceof DocumentTypeDefinitionInterface) {
         throw new CmisInvalidArgumentException(sprintf('Type definition must be instance of DocumentTypeDefinitionInterface but is "%s"', get_class($typeDefinition)));
     }
     $this->session = $session;
     parent::__construct($typeDefinition->getId());
     $this->populate($typeDefinition);
 }
 /**
  * @depends testDefaultValueForContentStreamAllowedIsSet
  */
 public function testGetContentStreamAllowedGetsPropertyValue()
 {
     $this->assertInstanceOf('\\Dkd\\PhpCmis\\Enum\\ContentStreamAllowed', $this->documentTypeDefinition->getContentStreamAllowed());
 }
 public function convertTypeDefinitionDataProvider()
 {
     $folderTypeDefinition = new FolderTypeDefinition('cmis:folder');
     $folderTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_FOLDER));
     $typeMutability = new TypeMutability();
     $typeMutability->setCanCreate(true);
     $typeMutability->setCanUpdate(true);
     $typeMutability->setCanDelete(true);
     $documentTypeDefinition = new DocumentTypeDefinition('cmis:document');
     $documentTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_DOCUMENT));
     $documentTypeDefinition->setContentStreamAllowed(ContentStreamAllowed::cast(ContentStreamAllowed::ALLOWED));
     $documentTypeDefinition->setDescription('description');
     $documentTypeDefinition->setDisplayName('displayName');
     $documentTypeDefinition->setIsControllableACL(true);
     $documentTypeDefinition->setIsVersionable(true);
     $documentTypeDefinition->setIsControllablePolicy(true);
     $documentTypeDefinition->setIsCreatable(true);
     $documentTypeDefinition->setIsFileable(true);
     $documentTypeDefinition->setIsFulltextIndexed(true);
     $documentTypeDefinition->setIsIncludedInSupertypeQuery(true);
     $documentTypeDefinition->setIsQueryable(true);
     $documentTypeDefinition->setLocalName('localName');
     $documentTypeDefinition->setLocalNamespace('localNamespace');
     $documentTypeDefinition->setParentTypeId('parentTypeId');
     $documentTypeDefinition->setQueryName('queryName');
     $documentTypeDefinition->setTypeMutability($typeMutability);
     $relationshipTypeDefinition = new RelationshipTypeDefinition('cmis:relationship');
     $relationshipTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_RELATIONSHIP));
     $relationshipTypeDefinition->setAllowedSourceTypeIds(array('foo'));
     $relationshipTypeDefinition->setAllowedTargetTypeIds(array('bar'));
     $policyTypeDefinition = new PolicyTypeDefinition('cmis:policy');
     $policyTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_POLICY));
     $itemTypeDefinition = new ItemTypeDefinition('cmis:item');
     $itemTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_ITEM));
     $secondaryTypeDefinition = new SecondaryTypeDefinition('cmis:secondary');
     $secondaryTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_SECONDARY));
     return array('Folder type definition' => array($folderTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:folder', JSONConstants::JSON_TYPE_BASE_ID => BaseTypeId::CMIS_FOLDER)), 'Document type definition' => array($documentTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:document', JSONConstants::JSON_TYPE_BASE_ID => BaseTypeId::CMIS_DOCUMENT, JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED => ContentStreamAllowed::ALLOWED, JSONConstants::JSON_TYPE_DESCRIPTION => 'description', JSONConstants::JSON_TYPE_DISPLAYNAME => 'displayName', JSONConstants::JSON_TYPE_LOCALNAME => 'localName', JSONConstants::JSON_TYPE_LOCALNAMESPACE => 'localNamespace', JSONConstants::JSON_TYPE_PARENT_ID => 'parentTypeId', JSONConstants::JSON_TYPE_QUERYNAME => 'queryName', JSONConstants::JSON_TYPE_CONTROLABLE_ACL => true, JSONConstants::JSON_TYPE_VERSIONABLE => true, JSONConstants::JSON_TYPE_CONTROLABLE_POLICY => true, JSONConstants::JSON_TYPE_CREATABLE => true, JSONConstants::JSON_TYPE_FILEABLE => true, JSONConstants::JSON_TYPE_FULLTEXT_INDEXED => true, JSONConstants::JSON_TYPE_INCLUDE_IN_SUPERTYPE_QUERY => true, JSONConstants::JSON_TYPE_QUERYABLE => true, JSONConstants::JSON_TYPE_TYPE_MUTABILITY => array(JSONConstants::JSON_TYPE_TYPE_MUTABILITY_UPDATE => true, JSONConstants::JSON_TYPE_TYPE_MUTABILITY_CREATE => true, JSONConstants::JSON_TYPE_TYPE_MUTABILITY_DELETE => true), JSONConstants::JSON_TYPE_PROPERTY_DEFINITIONS => array(array()))), 'Relationship type definition' => array($relationshipTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:relationship', JSONConstants::JSON_TYPE_BASE_ID => 'cmis:relationship', JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES => array('foo', false, null, ''), JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES => array('bar', false, null, ''))), 'Policy type definition' => array($policyTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:policy', JSONConstants::JSON_TYPE_BASE_ID => 'cmis:policy')), 'Item type definition' => array($itemTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:item', JSONConstants::JSON_TYPE_BASE_ID => 'cmis:item')), 'Secondary type definition' => array($secondaryTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:secondary', JSONConstants::JSON_TYPE_BASE_ID => 'cmis:secondary')));
 }