diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-12-06 20:19:54 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-12-06 20:19:54 -0800 |
commit | 2132c9a96d923d48effc3fe8facedff4a4da3b13 (patch) | |
tree | baea730cc1b7182f34c94a33d8caf7ded2780701 /modules/tag/models | |
parent | 5a7449f31574c7c548abe4244a6ba0993138e013 (diff) |
Fix some database calls.
Diffstat (limited to 'modules/tag/models')
-rw-r--r-- | modules/tag/models/tag.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index f9a453be..b60f8dfc 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -63,13 +63,21 @@ class Tag_Model extends ORM { public function save() { $db = Database::instance(); $related_item_ids = array(); - foreach ($db->getwhere("items_tags", array("tag_id" => $this->id)) as $row) { + foreach (db::build() + ->select("item_id") + ->from("items_tags") + ->where("tag_id", "=", $this->id) + ->execute() as $row) { $related_item_ids[$row->item_id] = 1; } $result = parent::save(); - foreach ($db->getwhere("items_tags", array("tag_id" => $this->id)) as $row) { + foreach (db::build() + ->select("item_id") + ->from("items_tags") + ->where("tag_id", "=", $this->id) + ->execute() as $row) { $related_item_ids[$row->item_id] = 1; } @@ -89,7 +97,12 @@ class Tag_Model extends ORM { public function delete() { $related_item_ids = array(); $db = Database::Instance(); - foreach ($db->getwhere("items_tags", array("tag_id" => $this->id)) as $row) { + + foreach (db::build() + ->select("item_id") + ->from("items_tags") + ->where("tag_id", "=", $this->id) + ->execute() as $row) { $related_item_ids[$row->item_id] = 1; } |