Example #1
0
 /**
  * Fetch data from the database
  *
  * @param string $xref
  * @param int    $tree_id
  *
  * @return null|string
  */
 protected static function fetchGedcomRecord($xref, $tree_id)
 {
     // We don't know what type of object this is.  Try each one in turn.
     $data = Individual::fetchGedcomRecord($xref, $tree_id);
     if ($data) {
         return $data;
     }
     $data = Family::fetchGedcomRecord($xref, $tree_id);
     if ($data) {
         return $data;
     }
     $data = Source::fetchGedcomRecord($xref, $tree_id);
     if ($data) {
         return $data;
     }
     $data = Repository::fetchGedcomRecord($xref, $tree_id);
     if ($data) {
         return $data;
     }
     $data = Media::fetchGedcomRecord($xref, $tree_id);
     if ($data) {
         return $data;
     }
     $data = Note::fetchGedcomRecord($xref, $tree_id);
     if ($data) {
         return $data;
     }
     // Some other type of record...
     return Database::prepare("SELECT o_gedcom FROM `##other` WHERE o_id = :xref AND o_file = :tree_id")->execute(array('xref' => $xref, 'tree_id' => $tree_id))->fetchOne();
 }