public function setTagsForElement($cType, $cId, array $tags)
{
$this->db->beginTransaction();
try {
$this->db->delete("tags_assignment", "ctype = " . $this->db->quote($cType) . " AND cid = " . $this->db->quote($cId));
foreach ($tags as $tag) {
$this->doAddTagToElement($tag->getId(), $cType, $cId);
}
$this->db->commit();
} catch (\Exception $e) {
$this->db->rollBack();
throw $e;
}
}