/** * @return array */ public function getConstructorStatementGenerationData() { $propertyDefinition1 = new PropertyStringDefinition('p1'); $propertyDefinition1->setQueryName('p1-qn'); $propertyDefinition2 = new PropertyStringDefinition('p2'); $propertyDefinition2->setQueryName('p2-qn'); $typeDefinition1 = new SecondaryTypeDefinition('t1'); $typeDefinition1->setQueryName('t1-qn'); $typeDefinition2 = new SecondaryTypeDefinition('t2'); $typeDefinition2->setQueryName('t2-qn'); return array('Statement passed through if provided' => array(array('foobar-statement', array(), array(), null, array()), 'foobar-statement'), 'Single property from single type without clause without ordering' => array(array(null, array('p1'), array('t1'), null, array()), 'SELECT p1 FROM t primary'), 'Single property from single type with alias without clause without ordering' => array(array(null, array('p1'), array('t1 alias1'), null, array()), 'SELECT p1 FROM t alias1'), 'Single property from single type with clause without ordering' => array(array(null, array('p1'), array('t1'), '1=1', array()), 'SELECT p1 FROM t primary WHERE 1=1'), 'Single property from single type with clause with ordering' => array(array(null, array('p1'), array('t1'), '1=1', array('p1 ASC')), 'SELECT p1 FROM t primary WHERE 1=1 ORDER BY p1 ASC'), 'Single property from two types without clause without ordering' => array(array(null, array('p1'), array('t1', 't2'), null, array()), 'SELECT p1 FROM t primary JOIN t AS a ON primary.cmis:objectId = a.cmis:objectId'), 'Two properties from single type without clause without ordering' => array(array(null, array('p1', 'p2'), array('t1'), null, array()), 'SELECT p1, p2 FROM t primary'), 'Two properties from two types without clause without ordering' => array(array(null, array('p1', 'p2'), array('t1', 't2'), null, array()), 'SELECT p1, p2 FROM t primary JOIN t AS a ON primary.cmis:objectId = a.cmis:objectId'), 'Two properties from two types with clause without ordering' => array(array(null, array('p1', 'p2'), array('t1', 't2'), '1=1', array()), 'SELECT p1, p2 FROM t primary JOIN t AS a ON primary.cmis:objectId = a.cmis:objectId WHERE 1=1'), 'Two properties from two types with clause with ordering' => array(array(null, array('p1', 'p2'), array('t1', 't2'), '1=1', array('p1 ASC')), 'SELECT p1, p2 FROM t primary JOIN t AS a ON primary.cmis:objectId = a.cmis:objectId WHERE 1=1' . ' ORDER BY p1 ASC'), 'Multiple orderings without clause' => array(array(null, array('p1', 'p2'), array('t1'), null, array('p1 ASC', 'p2 DESC')), 'SELECT p1, p2 FROM t primary ORDER BY p1 ASC, p2 DESC'), 'Multiple orderings with clause' => array(array(null, array('p1', 'p2'), array('t1'), '1=1', array('p1 ASC', 'p2 DESC')), 'SELECT p1, p2 FROM t primary WHERE 1=1 ORDER BY p1 ASC, p2 DESC'), 'Alias of tables provided for single table' => array(array(null, array('p1'), array(array('t1', 'alias')), null, array()), 'SELECT p1 FROM t alias'), 'Alias of tables provided for multiple tables' => array(array(null, array('p1'), array(array('t1', 'alias1'), array('t2', 'alias2')), null, array()), 'SELECT p1 FROM t alias1 JOIN t AS alias2 ON alias1.cmis:objectId = alias2.cmis:objectId'), 'TypeDefinition instance in property list' => array(array(null, array($propertyDefinition1), array('t1'), null, array()), 'SELECT p1-qn FROM t primary'), 'Multiple TypeDefinition instances in property list' => array(array(null, array($propertyDefinition1, $propertyDefinition2), array('t1'), null, array()), 'SELECT p1-qn, p2-qn FROM t primary'), 'TypeDefinition instance in types list' => array(array(null, array('p1'), array($typeDefinition1), null, array()), 'SELECT p1 FROM t primary'), 'TypeDefinition instance with alias in types list' => array(array(null, array('p1'), array(array($typeDefinition1, 'alias1')), null, array()), 'SELECT p1 FROM t alias1'), 'Multiple TypeDefinition instances in types list' => array(array(null, array('p1'), array($typeDefinition1, $typeDefinition2), null, array()), 'SELECT p1 FROM t primary JOIN t AS a ON primary.cmis:objectId = a.cmis:objectId'), 'Multiple TypeDefinition instances with aliases in types list' => array(array(null, array('p1'), array(array($typeDefinition1, 'alias1'), array($typeDefinition2, 'alias2')), null, array()), 'SELECT p1 FROM t alias1 JOIN t AS alias2 ON alias1.cmis:objectId = alias2.cmis:objectId'), 'TypeDefinition instance in orderings list' => array(array(null, array('p1'), array('t1'), null, array($propertyDefinition1)), 'SELECT p1 FROM t primary ORDER BY p1-qn ASC'), 'Multiple TypeDefinition instances in orderings list' => array(array(null, array('p1'), array('t1'), null, array($propertyDefinition1, $propertyDefinition2)), 'SELECT p1 FROM t primary ORDER BY p1-qn ASC, p2-qn ASC'), 'Multiple TypeDefinition instances with direction in orderings list' => array(array(null, array('p1'), array('t1'), null, array(array($propertyDefinition1, 'DESC'), array($propertyDefinition2, 'DESC'))), 'SELECT p1 FROM t primary ORDER BY p1-qn DESC, p2-qn DESC')); }
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'))); }