public function getDatasetLocation()
 {
     if ($this->_datasetLocation === null) {
         $DatasetLocations = new Default_Model_DatasetLocations();
         $DatasetLocations->filter->id->equals($this->getDatasetLocationID());
         if ($DatasetLocations->count() > 0) {
             $this->_datasetLocation = $DatasetLocations->items[0];
         }
     }
     return $this->_datasetLocation;
 }
Esempio n. 2
0
 /**
  * @overrides delete() from RestResource
  */
 public function delete()
 {
     if (parent::delete() !== false) {
         $ret = $this->get();
         $locs = new Default_Model_DatasetLocations();
         $lid = $this->getParam("lid");
         $locs->filter->id->numequals($lid);
         if (count($locs->items) == 1) {
             $loc = $locs->items[0];
             db()->exec("DELETE FROM dataset_location_organizations WHERE dataset_location_id = " . $lid);
             db()->exec("DELETE FROM dataset_location_sites WHERE dataset_location_id = " . $lid);
             $locs->remove($loc);
         }
         return $ret;
     } else {
         return false;
     }
 }