/** Gets TRelationType object by ID * @return TRelationType or NULL in case of error */ public static function getByID($_id) { $relation_arr = TRelationType::getRelationType("id", $_id); return $relation_arr[0]; }
/** Gets TRelation object by property $property_name with value $property_value. * @return TRelation or NULL in case of error */ public static function getRelation($property_name, $property_value, $meaning_obj = NULL) { $link_db = Piwidict::getDatabaseConnection(); $query = "SELECT * FROM relation WHERE `{$property_name}`='{$property_value}' order by id"; $result = $link_db->query_e($query, "Query failed in " . __METHOD__ . " in file <b>" . __FILE__ . "</b>, string <b>" . __LINE__ . "</b>"); if ($link_db->query_count($result) == 0) { return NULL; } $relation_arr = array(); while ($row = $result->fetch_object()) { /* if ($meaning_obj == NULL) $meaning_obj = TMeaning::getByID($row->meaning_id); */ $relation_arr[] = new TRelation($row->id, $meaning_obj, TWikiText::getByID($row->wiki_text_id), TRelationType::getByID($row->relation_type_id), $row->meaning_summary); } return $relation_arr; }