public static function removeTag($document, $tagId, $updateCache = true) { try { $c = new Criteria(); $c->add(TagPeer::TAG_ID, $tagId); $tag = TagPeer::doSelectOne($c); $tagRelation = TagrelationPeer::retrieveByPk($document->getId(), $tag->getId()); if ($tagRelation) { $tagRelation->delete(); if ($updateCache) { Tagrelation::updateTagRelationCache(); } } } catch (Exception $e) { throw $e; } }