From 2b1f68a6546b7a2743efaca2f224c1de90e17d1d Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 27 Feb 2009 00:19:12 +0000 Subject: Continue the journey of replacing raw sql with ORM or Database method calls (Ticket #68) --- modules/tag/controllers/admin_tags.php | 2 +- modules/tag/helpers/tag_event.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index 1d800fce..d6ae310b 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -50,7 +50,7 @@ class Admin_Tags_Controller extends Admin_Controller { $form = tag::get_delete_form($tag); if ($form->validate()) { $name = $tag->name; - Database::instance()->query("DELETE from `items_tags` where `tag_id` = $tag->id"); + Database::instance()->delete("items_tags", array("tag_id" => "$tag->id")); $tag->delete(); message::success(t("Deleted tag %tag_name", array("tag_name" => $name))); log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name))); diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 7192edec..47391355 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -54,7 +54,7 @@ class tag_event_Core { "AND `id` IN (SELECT `tag_id` from `items_tags` WHERE `item_id` = $item->id)"); $db->query("DELETE FROM `tags` WHERE `count` = 0 AND `id` IN (" . "SELECT `tag_id` from `items_tags` WHERE `item_id` = $item->id)"); - $db->query("DELETE FROM `items_tags` WHERE `item_id` = $item->id;"); + $db->delete("items_tags", array("item_id" => "$item->id")); } } -- cgit v1.2.3