From cc79abd0af83fdde471031b0629e8c7b0318790d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Jan 2010 14:00:07 -0800 Subject: Simplify tag::add(). --- modules/tag/helpers/tag.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'modules') diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 9e59b527..a500be58 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -37,17 +37,11 @@ class tag_Core { if (!$tag->loaded()) { $tag->name = $tag_name; $tag->count = 0; - $tag->save(); } - if (!$tag->has($item)) { - if (!$tag->add($item)) { - throw new Exception("@todo {$tag->name} WAS_NOT_ADDED_TO {$item->id}"); - } - $tag->count++; - $tag->save(); - } - return $tag; + $tag->add($item); + $tag->count++; + return $tag->save(); } /** -- cgit v1.2.3