diff options
author | middeke <martin@middeke.de> | 2015-12-23 00:03:56 +0100 |
---|---|---|
committer | middeke <martin@middeke.de> | 2015-12-23 00:03:56 +0100 |
commit | be2fde7cc01228ad4526e05d77a3d4865e550357 (patch) | |
tree | 4bafef42ffee947dee16f6f5626817e8628285b1 /app/Model | |
parent | 7e014e4fe9fb95803054fde958f7b77e32506932 (diff) |
remove function for MetaData
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Metadata.php | 23 |
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; + } } |