Esempio n. 1
0
 private function load()
 {
     if (!$this->libraryID) {
         throw new Exception("Library ID not set");
     }
     if (!$this->id && !$this->key) {
         throw new Exception("ID or key not set");
     }
     if ($this->id) {
         //Z_Core::debug("Loading data for creator $this->libraryID/$this->id");
         $row = Zotero_Creators::getPrimaryDataByID($this->libraryID, $this->id);
     } else {
         //Z_Core::debug("Loading data for creator $this->libraryID/$this->key");
         $row = Zotero_Creators::getPrimaryDataByKey($this->libraryID, $this->key);
     }
     $this->loaded = true;
     $this->changed = array();
     if (!$row) {
         return;
     }
     if ($row['libraryID'] != $this->libraryID) {
         throw new Exception("libraryID {$row['libraryID']} != {$this->libraryID}");
     }
     foreach ($row as $key => $val) {
         $this->{$key} = $val;
     }
 }