/**
  * 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;
 }
Example #2
0
 public function GetProperties($max = null)
 {
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjectProperties WHERE property_ObjectID = " . $this->ID;
     if (is_numeric($max)) {
         $query .= " LIMIT " . $max;
     }
     $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();
         $retval[] = TenantObjectProperty::GetByAssoc($values);
     }
     return $retval;
 }
 /**
  * Retrieves a single TenantObjectProperty with the given ID.
  * @param int $id The ID of the TenantObjectProperty to return
  * @return NULL|\PhoenixSNS\Objects\TenantObjectProperty The TenantObjectProperty with the given ID, or NULL if no TenantObjectProperty with the given ID was found
  */
 public static function GetByID($id)
 {
     if (!is_numeric($id)) {
         return null;
     }
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjectProperties";
     $result = $MySQL->query($query);
     $count = $result->num_rows;
     if ($count == 0) {
         return null;
     }
     $values = $result->fetch_assoc();
     return TenantObjectProperty::GetByAssoc($values);
 }