summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2011-01-15 14:20:26 -0800
committerBharat Mediratta <bharat@menalto.com>2011-01-15 14:20:26 -0800
commit02f30b91bf8f68118a578de2194e66a7a16a291a (patch)
treea565ccac0fefb6bd73b9c991ef1523c3455408ae /modules/tag
parentee13b934f46d67982e5eeea21f81ac58f166741c (diff)
Follow on to 966dee8628293f78fbf9431281709ceba011d3c2 for #1586 --
don't try to update the tag item count if we didn't change any items with this change (ie: a tag rename). In that case, we haven't loaded the related items so we don't have any idea what the count is going to be.
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/models/tag.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php
index 25df87e0..2b73b5be 100644
--- a/modules/tag/models/tag.php
+++ b/modules/tag/models/tag.php
@@ -78,12 +78,14 @@ class Tag_Model_Core extends ORM {
$related_item_ids[$row->item_id] = 1;
}
- $added = array_diff($this->changed_relations["items"], $this->object_relations["items"]);
- $removed = array_diff($this->object_relations["items"], $this->changed_relations["items"]);
- if (isset($this->changed_relations["items"])) {
- $changed = array_merge($added, $removed);
+ if (isset($this->object_relations["items"])) {
+ $added = array_diff($this->changed_relations["items"], $this->object_relations["items"]);
+ $removed = array_diff($this->object_relations["items"], $this->changed_relations["items"]);
+ if (isset($this->changed_relations["items"])) {
+ $changed = array_merge($added, $removed);
+ }
+ $this->count = count($this->object_relations["items"]) + count($added) - count($removed);
}
- $this->count = count($this->object_relations["items"]) + count($added) - count($removed);
$result = parent::save();