summaryrefslogtreecommitdiff
path: root/app/Model/Metadata.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Metadata.php')
-rw-r--r--app/Model/Metadata.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/Model/Metadata.php b/app/Model/Metadata.php
index 83c8f499..ae7475c4 100644
--- a/app/Model/Metadata.php
+++ b/app/Model/Metadata.php
@@ -95,4 +95,27 @@ abstract class Metadata extends Base
return ! in_array(false, $results, true);
}
+
+ /**
+ * Remove a metadata
+ *
+ * @access public
+ * @param integer $entity_id
+ * @param string $name
+ * @return bool
+ */
+ public function remove($entity_id, $name)
+ {
+
+ $this->db->startTransaction();
+
+ if (! $this->db->table(static::TABLE)->eq($this->getEntityKey(), $entity_id)->eq('name', $name)->remove()) {
+ $this->db->cancelTransaction();
+ return false;
+ }
+
+ $this->db->closeTransaction();
+
+ return true;
+ }
}