public function TripalEntityCollection::delete
3.x TripalEntityCollection.inc | public TripalEntityCollection::delete() |
Deletes the current collection
File
- tripal/
includes/ TripalEntityCollection.inc, line 56
Class
Code
public function delete() {
if (!$this->collection_id) {
throw new Exception('This data collection object has not yet been loaded. Cannot delete.');
}
try {
// Remove any files that may have been created
foreach ($this->formatters as $class_name => $label) {
tripal_load_include_downloader_class($class_name);
$outfile = $this->getOutfile($class_name);
$downloader = new $class_name($this->collection_id, $outfile);
$downloader->delete();
}
// Delete from the tripal collection table.
db_delete('tripal_collection')
->condition('collection_id', $this->collection_id)
->execute();
// Delete the field groups from the tripal_bundle_collection table.
db_delete('tripal_collection_bundle')
->condition('collection_id', $this->collection_id)
->execute();
// Reset the class to defaults.
$this->collection_id = NULL;
$this->collection_name = '';
$this->create_date = '';
$this->description = '';
}
catch (Exception $e) {
throw new Exception('Cannot delete collection: ' . $e->getMessage());
}
}