remove function for MetaData

This commit is contained in:
middeke 2015-12-23 00:03:56 +01:00
parent 7e014e4fe9
commit be2fde7cc0
1 changed files with 23 additions and 0 deletions

View File

@ -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;
}
}