Revert "MINOR: removing comments"

This reverts commit de09822ce0.
This commit is contained in:
Julian Seidenberg 2012-07-27 12:54:38 +12:00
parent 9ba84e6211
commit e3c49aa775
1 changed files with 17 additions and 0 deletions

View File

@ -176,6 +176,8 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
$tags = $this->getTagsObjects($category, $value);
if ($tags->Count() > 0) {
$tagsToDelete = array();
foreach($tags as $t) {
$documentList = $t->Documents();
@ -185,6 +187,13 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
//delete the entire tag if it has no relations left
if ($documentList->Count() == 0) $t->delete();
}
//TODO: remove this comment if unit tests work fine
//delete after the loop, so it doesn't conflict with the loop of the $tags list
// foreach($tagsToDelete as $tID) {
// $tag = DataObject::get_by_id("DMSTag",$tID);
// $tag->delete();
// }
}
}
@ -193,12 +202,20 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
* @return null
*/
function removeAllTags() {
$tagsToDelete = array();
$allTags = $this->Tags();
foreach($allTags as $tag) {
$documentlist = $tag->Documents();
$documentlist->remove($this);
if ($tag->Documents()->Count() == 0) $tag->delete();
}
//TODO: remove this comment if unit tests work fine
//delete after the loop, so it doesn't conflict with the loop of the $tags list
// foreach($tagsToDelete as $tID) {
// $tag = DataObject::get_by_id("DMSTag",$tID);
// $tag->delete();
// }
}
/**