예제 #1
0
 public function load_relationships()
 {
     $db = Database::get_instance();
     $this->relationships = array();
     $query = $db->prepare("SELECT id FROM relationships WHERE (subject_id_1=? OR subject_id_2=?)");
     $data = array($this->id, $this->id);
     if ($query->execute($data)) {
         while ($row = $query->fetch()) {
             $new_relationship = new Relationship();
             $new_relationship->load($row['id']);
             $this->relationships[] = $new_relationship;
         }
         return true;
     } else {
         return false;
     }
 }