示例#1
0
 /**
  * Gets several Property types.
  * @internal Not fully implemented yet. Only an array of system names are respected for now. Other values may cause undefined behaviour.
  * @param mixed $param Either an array of system names of property types or a category id or null.
  * @throws CommunicationException Thrown if something went wrong while getting the property types.
  * @throws ConnectionException Thrown if something went wrong with the connection.
  * @author Björn Hjortsten
  * @return array An array of {@link PropertyType}s.
  */
 public function getPropertyTypes($param = null)
 {
     if (is_array($param)) {
         $data['propertyTypeNames'] = $param;
     } elseif (is_numeric($param)) {
         $data['categoryId'] = intval($param);
     } else {
         // Don't send anything to get everything!
     }
     $result = $this->call('getPropertyTypes', $data);
     foreach ($result->propertyTypes as $propertyName => $propertyType) {
         if (empty($propertyType)) {
             trigger_error('Skipping property type "' . $propertyName . '". Probably does not exist.', 'warning');
             continue;
         }
         $propertyTypes[$propertyType->propertyName] = PropertyType::createFromRawObject($propertyType);
     }
     return $propertyTypes;
 }
示例#2
0
 /**
  * Creates a new property.
  * @param int $id The id of the property.
  * @param int $propertyTypeId The id of the propertys type.
  * @param string $systemName The system name of the property.
  * @param string $title The display name of the property.
  * @param mixed $value The value of the property.
  * @param mixed $defaultValue The default value of the property.
  * @param PropertyValueType $propertyValueType The type of the propertys value and default value.
  * @param bool $multipleChoice If this propertys value are multiple values.
  * @param bool $editable If the user should be able to modify the property value. {@internal Probably not used at all. }
  * @author Björn Hjortsten
  * @return Property
  */
 public function __construct($id, $propertyTypeId, $systemName, $title, $value, $defaultValue = null, $propertyValueType = PropertyValueType::QB_String, $multipleChoice = false, $editable = true)
 {
     $this->id = $id;
     parent::__construct($propertyTypeId, $systemName, $title, $value, $defaultValue, $propertyValueType, $multipleChoice, $editable);
 }