diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-12-06 21:38:09 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-12-06 21:38:09 -0800 |
commit | a6dbd25cf11e1b5044862eea9bac0ff3cdf6de80 (patch) | |
tree | edd5b86a8f60a32edbf886d65a2badd92af697c0 | |
parent | 2ff84b092d0b9d8ca61b313d2aa5d7941f3f8711 (diff) |
Update database queries.
-rw-r--r-- | modules/comment/helpers/comment_event.php | 31 | ||||
-rw-r--r-- | modules/notification/helpers/notification_event.php | 10 |
2 files changed, 23 insertions, 18 deletions
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php index c90f7663..576e041d 100644 --- a/modules/comment/helpers/comment_event.php +++ b/modules/comment/helpers/comment_event.php @@ -19,29 +19,32 @@ */ class comment_event_Core { static function item_deleted($item) { - Database::instance()->delete("comments", array("item_id" => $item->id)); + db::build() + ->delete("comments") + ->where("item_id", "=", $item->id); } static function user_deleted($user) { $guest = identity::guest(); - Database::instance()->from("comments") - ->set(array("author_id" => $guest->id, - "guest_email" => null, - "guest_name" => "guest", - "guest_url" => null)) + db::build() + ->update("comments") + ->set("author_id", $guest->id) + ->set("guest_email", null) + ->set("guest_name", "guest") + ->set("guest_url", null) ->where("author_id", "=", $user->id) - ->update(); + ->execute(); } static function identity_provider_changed($old_provider, $new_provider) { $guest = identity::guest(); - Database::instance()->from("comments") - ->set(array("author_id" => $guest->id, - "guest_email" => null, - "guest_name" => "guest", - "guest_url" => null)) - ->where("1", "=", "1") // @todo: why do we do this? - ->update(); + db::build() + ->update("comments") + ->set("author_id", $guest->id) + ->set("guest_email", null) + ->set("guest_name", "guest") + ->set("guest_url", null) + ->execute(); } static function admin_menu($menu, $theme) { diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index 951e6e52..2c7ede27 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -53,14 +53,16 @@ class notification_event_Core { } static function user_deleted($user) { - ORM::factory("subscriptions") + db::build() + ->delete("subscriptions") ->where("user_id", "=", $user->id) - ->delete_all(); + ->execute(); } static function identity_provider_changed($old_provider, $new_provider) { - ORM::factory("subscriptions") - ->delete_all(); + db::build() + ->delete("subscriptions") + ->execute(); } static function comment_created($comment) { |