|
@@ -60,10 +60,15 @@ class TripalEntityCollection {
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
+ // Delete from the tripal collection table.
|
|
db_delete('tripal_collection')
|
|
db_delete('tripal_collection')
|
|
->condition('collection_id', $this->collection_id)
|
|
->condition('collection_id', $this->collection_id)
|
|
->execute();
|
|
->execute();
|
|
-
|
|
|
|
|
|
+ // Delete the field groups from the tripal_bundle_collection table.
|
|
|
|
+ db_delete('tripal_bundle_collection')
|
|
|
|
+ ->condition('collection_id', $this->collection_id)
|
|
|
|
+ ->execute();
|
|
|
|
+
|
|
// Remove any files that may have been created
|
|
// Remove any files that may have been created
|
|
foreach ($this->downloaders as $class_name => $label) {
|
|
foreach ($this->downloaders as $class_name => $label) {
|
|
tripal_load_include_downloader_class($class_name);
|
|
tripal_load_include_downloader_class($class_name);
|
|
@@ -177,16 +182,14 @@ class TripalEntityCollection {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Creates a new collection.
|
|
|
|
|
|
+ * Creates a new unique collection ID used as a look up against the
|
|
|
|
+ * tripal_collection_bundle to find fields, ids, and bundles.
|
|
*
|
|
*
|
|
* @param $details
|
|
* @param $details
|
|
* An association array containing the details for a collection. The
|
|
* An association array containing the details for a collection. The
|
|
* details must include the following key/value pairs:
|
|
* details must include the following key/value pairs:
|
|
* - uid: The ID of the user that owns the collection
|
|
* - uid: The ID of the user that owns the collection
|
|
* - collection_name: The name of the collection
|
|
* - collection_name: The name of the collection
|
|
- * - bundle_name: The name of the TripalEntity content type.
|
|
|
|
- * - ids: An array of the entity IDs that form the collection.
|
|
|
|
- * - fields: An array of the field IDs that the collection is limited to.
|
|
|
|
* - description: A user supplied description for the collection.
|
|
* - description: A user supplied description for the collection.
|
|
*
|
|
*
|
|
* @throws Exception
|
|
* @throws Exception
|
|
@@ -222,7 +225,7 @@ class TripalEntityCollection {
|
|
))
|
|
))
|
|
->execute();
|
|
->execute();
|
|
// Now add the second table with bundle info.
|
|
// Now add the second table with bundle info.
|
|
- $this->add($details, $collection_id);
|
|
|
|
|
|
+ $this->addFields($details, $collection_id);
|
|
// Now load the job into this object.
|
|
// Now load the job into this object.
|
|
$this->load($collection_id);
|
|
$this->load($collection_id);
|
|
}
|
|
}
|
|
@@ -243,7 +246,7 @@ class TripalEntityCollection {
|
|
*
|
|
*
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
- public function add($details, $collection_id) {
|
|
|
|
|
|
+ public function addFields($details, $collection_id) {
|
|
if (!$details['bundle_name']) {
|
|
if (!$details['bundle_name']) {
|
|
throw new Exception("Must provide a 'bundle_name' key to TripalEntityCollection::add().");
|
|
throw new Exception("Must provide a 'bundle_name' key to TripalEntityCollection::add().");
|
|
}
|
|
}
|