Пример #1
0
 /**
  * Creates a new TenantObject object based on the given values from the database.
  * @param array $values
  * @return \PhoenixSNS\Objects\TenantObject based on the values of the fields in the given associative array
  */
 public static function GetByAssoc($values)
 {
     $item = new TenantObject();
     $item->ID = $values["object_ID"];
     $item->Tenant = Tenant::GetByID($values["object_TenantID"]);
     $item->Module = Module::GetByID($values["object_ModuleID"]);
     $item->ParentObject = TenantObject::GetByID($values["object_ParentObjectID"]);
     $item->DefaultProperty = TenantObjectProperty::GetByID($values["object_DefaultPropertyID"]);
     $item->Name = $values["object_Name"];
     return $item;
 }
 /**
  * Gets an array of all the TenantObjectInstancePropertyValues associated with this TenantObjectInstance.
  * @return TenantObjectInstancePropertyValue[] all the property values associated with this instance
  * @see TenantObjectInstancePropertyValue
  */
 public function GetPropertyValues()
 {
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjectInstancePropertyValues WHERE propval_InstanceID = " . $this->ID;
     $result = $MySQL->query($query);
     $retval = array();
     if ($result === false) {
         return $retval;
     }
     $count = $result->num_rows;
     for ($i = 0; $i < $count; $i++) {
         $values = $result->fetch_assoc();
         $property = TenantObjectProperty::GetByID($values["propval_PropertyID"]);
         $value = $property->Decode($values["propval_Value"]);
         $retval[] = new TenantObjectInstancePropertyValue($property, $value);
     }
     return $retval;
 }