Example #1
0
 /**
  * Associates the specified TenantObjectInstanceProperty with this TenantObject.
  * @param TenantObjectInstanceProperty $property The TenantObjectInstanceProperty to assocaite with this TenantObject.
  * @return boolean True if the operation completed successfuly; false if the operation failed.
  */
 public function CreateInstanceProperty($property)
 {
     global $MySQL;
     $query = "INSERT INTO " . System::$Configuration["Database.TablePrefix"] . "TenantObjectInstanceProperties (property_ObjectID, property_Name, property_DataTypeID, property_DefaultValue, property_IsRequired) VALUES (";
     $query .= $this->ID . ", ";
     $query .= "'" . $MySQL->real_escape_string($property->Name) . "', ";
     $query .= ($property->DataType == null ? "NULL" : $property->DataType->ID) . ", ";
     $query .= "'" . $MySQL->real_escape_string($property->Encode($property->DefaultValue)) . "', ";
     $query .= $property->Required ? "1" : "0";
     $query .= ")";
     $result = $MySQL->query($query);
     if ($result === false) {
         PhoenixSNS::Log("Database error when trying to create an instance property for the specified tenant object.", array("DatabaseError" => $MySQL->error . " (" . $MySQL->errno . ")", "Query" => $query));
         return false;
     }
     return true;
 }