public function removeInTag(NodeRef $nodeRef, Tag $tag) { $this->NodeEvents->fireNodeEvents(__FUNCTION__, '', $nodeRef, $tag); $id = $tag->getTagRole(); $schema = $nodeRef->getElement()->getSchema(); $tagDef = $schema->getTagDef($id); $tag = TagUtils::filterTagAgainstDef($tag, $tagDef); // retrieve the DB connection and table from DataSourceManager $db = $this->getConnectionForWrite($nodeRef); $id = $this->getRecordIDFromNodeRef($nodeRef); $matchPartial = $tag->getMatchPartial(); $matchPartial->TagSlug = $tag->getTagSlug(); // save the tags $this->NodeTagsDAO->saveInTags($db, $nodeRef, $id, $matchPartial->toString(), array()); }