コード例 #1
0
 /**
  * Initialize the CMIS Object
  *
  * @param SessionInterface $session
  * @param ObjectTypeInterface $objectType
  * @param OperationContextInterface $context
  * @param ObjectDataInterface|null $objectData
  */
 public function initialize(SessionInterface $session, ObjectTypeInterface $objectType, OperationContextInterface $context, ObjectDataInterface $objectData = null)
 {
     if (count($this->getMissingBaseProperties($objectType->getPropertyDefinitions())) !== 0) {
         throw new CmisInvalidArgumentException(sprintf('Object type must have at least the base property definitions! ' . 'These property definitions are missing: %s', implode(', ', PropertyIds::getBasePropertyKeys())));
     }
     $this->session = $session;
     $this->objectType = $objectType;
     $this->secondaryTypes = null;
     $this->creationContext = clone $context;
     $this->refreshTimestamp = (int) round(microtime(true) * 1000);
     if ($objectData !== null) {
         $this->initializeObjectData($objectData);
     }
 }
コード例 #2
0
 /**
  * Convert Properties in Properties instance to a list of PropertyInterface objects
  *
  * @param ObjectTypeInterface $objectType
  * @param SecondaryTypeInterface[] $secondaryTypes
  * @param PropertiesInterface $properties
  * @return PropertyInterface[]
  * @throws CmisInvalidArgumentException
  */
 public function convertPropertiesDataToPropertyList(ObjectTypeInterface $objectType, array $secondaryTypes, PropertiesInterface $properties)
 {
     if (count($objectType->getPropertyDefinitions()) === 0) {
         throw new CmisInvalidArgumentException('Object type has no property definitions!');
     }
     if (count($properties->getProperties()) === 0) {
         throw new CmisInvalidArgumentException('Properties must be set');
     }
     // Iterate trough properties and convert them to Property objects
     $result = array();
     foreach ($properties->getProperties() as $propertyKey => $propertyData) {
         // find property definition
         $apiProperty = $this->convertProperty($objectType, $secondaryTypes, $propertyData);
         $result[$propertyKey] = $apiProperty;
     }
     return $result;
 }