summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
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();