public function objectPropertyDataProvider()
 {
     $propertyType = PropertyType::cast(PropertyType::ID);
     $cardinality = Cardinality::cast(Cardinality::MULTI);
     $updatability = Updatability::cast(Updatability::ONCREATE);
     $choices = array($this->getMockBuilder('\\Dkd\\PhpCmis\\Definitions\\ChoiceInterface')->getMockForAbstractClass());
     return array(array('propertyType', $propertyType, $propertyType), array('cardinality', $cardinality, $cardinality), array('updatability', $updatability, $updatability), array('choices', $choices, $choices));
 }
示例#2
0
 /**
  * Returns if the property is a multi-value property.
  *
  * @return boolean <code>true</code> if the property is multi-value property, <code>false</code> if the property is
  *     single-value property,
  */
 public function isMultiValued()
 {
     return Cardinality::cast($this->getDefinition()->getCardinality())->equals(Cardinality::MULTI);
 }
 public function testPreparePropertyDefinitionDataConvertsValuesToExpectedValues()
 {
     $input = array(JSONConstants::JSON_PROPERTY_TYPE_PROPERTY_TYPE => 'boolean', JSONConstants::JSON_PROPERTY_TYPE_DEAULT_VALUE => true, JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION => 'date', JSONConstants::JSON_PROPERTY_TYPE_PRECISION => '32', JSONConstants::JSON_PROPERTY_TYPE_CARDINALITY => 'single', JSONConstants::JSON_PROPERTY_TYPE_UPDATABILITY => 'readonly');
     $expected = array(JSONConstants::JSON_PROPERTY_TYPE_PROPERTY_TYPE => PropertyType::cast('boolean'), JSONConstants::JSON_PROPERTY_TYPE_DEAULT_VALUE => array(true), JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION => DateTimeResolution::cast('date'), JSONConstants::JSON_PROPERTY_TYPE_PRECISION => DecimalPrecision::cast('32'), JSONConstants::JSON_PROPERTY_TYPE_CARDINALITY => Cardinality::cast('single'), JSONConstants::JSON_PROPERTY_TYPE_UPDATABILITY => Updatability::cast('readonly'));
     $this->assertEquals($expected, $this->getMethod(self::CLASS_TO_TEST, 'preparePropertyDefinitionData')->invokeArgs($this->jsonConverter, array($input)));
 }
$integer->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::INTEGER));
$integer->setLocalName('cmis:integerValue');
$integer->setQueryName('cmis:integerValue');
$integer->setIsInherited(true);
$integer->setIsOpenChoice(true);
$integer->setIsOrderable(false);
$integer->setDescription('This is a integer property.');
$integer->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$integer->setLocalNamespace('namespace');
$integer->setDisplayName('Integer property');
$integer->setIsRequired(false);
$integer->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$integer->setIsQueryable(true);
$integer->setMinValue(5);
$integer->setMaxValue(100);
$datetime = new \Dkd\PhpCmis\DataObjects\PropertyDateTimeDefinition('cmis:datetime');
$datetime->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::DATETIME));
$datetime->setLocalName('cmis:datetimeValue');
$datetime->setQueryName('cmis:datetimeValue');
$datetime->setIsInherited(true);
$datetime->setIsOpenChoice(true);
$datetime->setIsOrderable(false);
$datetime->setDescription('This is a datetime property.');
$datetime->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$datetime->setLocalNamespace('namespace');
$datetime->setDisplayName('Datetime property');
$datetime->setIsRequired(false);
$datetime->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$datetime->setIsQueryable(true);
$datetime->setDateTimeResolution(\Dkd\PhpCmis\Enum\DateTimeResolution::cast(\Dkd\PhpCmis\Enum\DateTimeResolution::TIME));
return array('cmis:id' => $id, 'cmis:string' => $string, 'cmis:boolean' => $boolean, 'cmis:uri' => $uri, 'cmis:decimal' => $decimal, 'cmis:html' => $html, 'cmis:integer' => $integer, 'cmis:datetime' => $datetime);
 /**
  * Cast data values to the expected type
  *
  * @param array $data
  * @return array
  */
 protected function preparePropertyDefinitionData(array $data)
 {
     $data[JSONConstants::JSON_PROPERTY_TYPE_PROPERTY_TYPE] = PropertyType::cast($data[JSONConstants::JSON_PROPERTY_TYPE_PROPERTY_TYPE]);
     if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_DEAULT_VALUE])) {
         $data[JSONConstants::JSON_PROPERTY_TYPE_DEAULT_VALUE] = (array) $data[JSONConstants::JSON_PROPERTY_TYPE_DEAULT_VALUE];
     }
     if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION])) {
         $data[JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION] = DateTimeResolution::cast($data[JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION]);
     }
     if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_PRECISION])) {
         $data[JSONConstants::JSON_PROPERTY_TYPE_PRECISION] = DecimalPrecision::cast($data[JSONConstants::JSON_PROPERTY_TYPE_PRECISION]);
     }
     if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_CARDINALITY])) {
         $data[JSONConstants::JSON_PROPERTY_TYPE_CARDINALITY] = Cardinality::cast($data[JSONConstants::JSON_PROPERTY_TYPE_CARDINALITY]);
     }
     if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_UPDATABILITY])) {
         $data[JSONConstants::JSON_PROPERTY_TYPE_UPDATABILITY] = Updatability::cast($data[JSONConstants::JSON_PROPERTY_TYPE_UPDATABILITY]);
     }
     return $data;
 }