summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-12-30 16:43:53 +0100
committerFrederic Guillot <fred@kanboard.net>2015-12-30 16:43:53 +0100
commit9039e27b13c7836dd22cef0a069c8f168e8f2287 (patch)
tree6a043af2ea2bd7dc567c279dd1f0443db5dc31b3 /app
parentca78f789690f154cf34383667b9977714f280415 (diff)
parent89e28f89b3c1c4adead0354c92df82f0a215c5ab (diff)
Merge pull-request #1583
Diffstat (limited to 'app')
-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;
+ }
}