/** * Retrieves a single TenantObject with the specified name from this Tenant. * @param string $name The name of the TenantObject to search for * @return NULL|TenantObject The TenantObject with the specified name, or NULL if no TenantObject with the specified name was found on this Tenant. */ public function GetObject($name) { global $MySQL; $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjects WHERE (object_TenantID IS NULL OR object_TenantID = " . $this->ID . ") AND object_Name = '" . $MySQL->real_escape_string($name) . "'"; $result = $MySQL->query($query); $count = $result->num_rows; if ($count == 0) { PhoenixSNS::Log("No object with the specified name was found.", array("Tenant" => $this->URL, "Object" => $name)); return null; } $values = $result->fetch_assoc(); $object = TenantObject::GetByAssoc($values); return $object; }
/** * Retrieves a single TenantObject with the given ID. * @param int $id The ID of the TenantObject to return * @return NULL|\PhoenixSNS\Objects\TenantObject The TenantObject with the given ID, or NULL if no TenantObject 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"] . "TenantObjects WHERE object_ID = " . $id; $result = $MySQL->query($query); if ($result === false) { return null; } $count = $result->num_rows; if ($count == 0) { return null; } $values = $result->fetch_assoc(); return TenantObject::GetByAssoc($values); }