public function delete() { // delete friend from all your lists $this->remove('lists'); if ($this->is_confirmed()) { // friend is friends with you // (as well as you being friends with friend) // get "you" as seen from your friend's friend list $friends_friend = $this->get_reverse_friend(); // delete friend from your friend list // can't do this too soon or we'll loose IDs $ret = parent::delete(); // delete you from friend's friend list // (which also deletes you from all friend's lists) // this has to be done after $this is deleted // othewise we'd get U.N.F.R.I.E.N.D.C.E.P.T.I.O.N. // That many dreams within dreams is too unstable! try { $friends_friend->delete(); } catch (Kohana_Exception $e) { // you're not your friend's friend for some reason } } else { // delete friend from your friend list $ret = parent::delete(); } return $ret; }
/** * Deletes the a form and all its associated data */ public function delete() { // Delete all fields associated with this form ORM::factory('form_field')->where('form_id', $this->id)->delete_all(); // Delete the field parent::delete(); }
/** * Overload delete to include assets * when the object is deleted. */ public function delete($id = NULL) { if ($id === NULL and $this->loaded) { #TODO: delete the associated images. } return parent::delete($id); }
/** * Override the delete method to clear cache */ public function delete($soft = FALSE) { parent::delete($soft); //cleanup the cache Cache::instance('roles')->delete_all(); return $this; }
public function delete($id = null) { if (!$this->loaded()) { $this->find($id); } //remove all comment logs for this comment type: comment, comment approved, comment received $site = Helper_Game::getSite(); $gameCommentId = $site->getEvent(Helper_Game::COMMENT)->id; $gameCommentApprovedId = $site->getEvent(Helper_Game::COMMENT_APPROVED)->id; $gameCommentReceivedId = $site->getEvent(Helper_Game::COMMENT_RECEIVED)->id; $infos = ORM::factory("Game_LogInfo")->and_where_open()->where("name", "like", "comment")->or_where("name", "like", "comment_id")->and_where_close()->and_where_open()->where("data", "=", $this->id)->or_where("data", "like", $this->comment)->and_where_close()->find_all(); foreach ($infos as $info) { $log = $info->_eventLog; switch ($log->event_id) { case $gameCommentId: case $gameCommentReceivedId: if ($log->data->comment == $this->id) { $log->delete(); } break; case $gameCommentApprovedId: if (empty($log->data->comment_id) && $log->item->item_id == $this->photo->id) { $log->delete(); } if (!empty($log->data->comment_id) && $log->data->comment_id == $this->id) { $log->delete(); } break; default: //do nothing break; } } parent::delete($id); }
/** * Overrides the default delete */ public function delete() { // Delete locations // Delete contacts // Delete emergencies parent::delete(); }
public function delete($id = NULL) { $post = ORM::factory('blog_post', (int) $this->blog_post_id); $post->comment_count -= 1; $post->save(); parent::delete($id); }
public function delete($id = NULL) { if (Auth::instance()->get_user()->id == $this->id || Auth::instance()->get_user()->id == $id) { return; } parent::delete($id); }
/** * Overrides the default behaviour to perform * extra tasks before removing the channel filter * entry */ public function delete() { // Delete the channel filter options DB::delete('channel_filter_options')->where('channel_filter_id', '=', $this->id)->execute(); // Default parent::delete(); }
/** * @see ORM::delete() */ public function delete($id = null) { $old = clone $this; module::event("group_before_delete", $this); parent::delete($id); module::event("group_deleted", $old); }
/** * @see ORM::delete() */ public function delete($id = null) { $old = clone $this; module::event("user_before_delete", $this); parent::delete($id); module::event("user_deleted", $old); $this->groups_cache = null; }
public function delete() { if (!$this->loaded()) { throw new Kohana_Exception('Method add_guest() must be called on loaded objects'); } ORM::factory('guest')->remove_from_table($this->pk()); return parent::delete(); }
public function delete() { if (!$this->loaded()) { throw new Kohana_Exception('Media not loaded'); } $this->_unlink(); return parent::delete(); }
public function delete() { $table_prefix = Kohana::config('database.default.table_prefix'); // Remove records referencing this permission // Have to use db->query() since we don't have an ORM model for permissions_roles $this->db->query('DELETE FROM ' . $table_prefix . 'permissions_roles WHERE permission_id = ?', $this->id); parent::delete(); }
/** * Simple delete of the object, plus a call to the unify to check to see if the * collection also needs to be deleted. * @return boolean $return, whether or not the call did everything expected */ public function delete() { $original = orm::factory('pigment', $this->id); $return = parent::delete(); if ($return) { $return = $this->unify($original); } }
public function delete() { if ((bool) $this->contents->count_all()) { foreach ($this->contents->find_all() as $content) { $content->delete(); } } return parent::delete(); }
public function delete() { $pass_id = $this->pass_id; $result = parent::delete(); if ($result) { $this->deleteTicket($pass_id); } return $result; }
/** * @see ORM::delete() */ public function delete($id = null) { $old = clone $this; module::event("group_before_delete", $this); parent::delete($id); db::build()->delete("groups_users")->where("group_id", "=", empty($id) ? $old->id : $id)->execute(); module::event("group_deleted", $old); $this->users_cache = null; }
/** * Deletes the menu and it's items * @return Bool parent::delete() */ public function delete() { if ($this->items->count_all() > 0) { foreach ($this->items->find_all() as $item) { $item->delete(); }
public function delete() { try { unlink($this->file->path . $this->filename); } catch (exception $e) { // erh.. } return parent::delete(); }
/** * Simple delete of the object, plus a call to the unify to check to see if the * pigment also needs to be deleted. * @return boolean $return, whether or not the call did everything expected */ public function delete() { $original = orm::factory('sheet', $this->id); $return = parent::delete(); // if it was deleted, then verfiy if ($return) { $return = $this->unify($original); } return $return; }
public function delete() { $widgets = $this->widgets->find_all(); if ((bool) $widgets->count()) { foreach ($widgets as $widget) { $widget->delete(); } } return parent::delete(); }
public function delete($id = NULL) { if (!$this->loaded()) { $this->find($id); } $ldata = $this->_data->find_all(); foreach ($ldata as $data) { $data->delete(); } parent::delete($id); }
public function delete() { // delete gifts on the list $gifts = $this->gifts->find_all(); foreach ($gifts as $gift) { $gift->delete(); } // // delete friends on the list $this->remove('friends'); return parent::delete(); }
public function delete() { $log = ORM::factory('activity'); $log->user_id = login::check_login()->id; $log->item_type = $this->object_name; $log->item_id = $this->id; $log->activity_type = "delete"; $log->item_old = serialize($this); $log->save(); return parent::delete(); }
/** * Recalculate the post count on delete. * * @return ORM */ public function delete() { // Update topic replies. $this->topic->replies--; $this->topic->save(); // Update post count. $user = $this->user; $user->set_property('forum.posts', $user->get_property('forum.posts') - 1); $user->save(); return parent::delete(); }
/** * Deletes a single post or multiple posts, ignoring relationships. * * @return ORM * @throws Gleez_Exception * @uses Path::delete */ public function delete() { if (!$this->_loaded) { throw new Gleez_Exception('Cannot delete :model model because it is not loaded.', array(':model' => $this->_object_name)); } $source = $this->rawurl; parent::delete(); // Delete the path aliases associated with this object Path::delete(array('source' => $source)); unset($source); return $this; }
public function delete() { if ($this->name == 'login' || $this->name == 'admin') { return false; } $users = $this->users->find_all(); if ((bool) $users->count()) { foreach ($users as $user) { $user->remove('roles', $this); } } return parent::delete(); }
/** * Overload ORM::delete() to trigger an item_related_update event for all items that are * related to this tag. */ public function delete() { $related_item_ids = array(); 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::delete(); if ($related_item_ids) { foreach (ORM::factory("item")->where("id", "IN", array_keys($related_item_ids))->find_all() as $item) { module::event("item_related_update", $item); } } return $result; }
/** * Deletes a single post or multiple posts, ignoring relationships. * * @param boolean $soft Make delete as soft or hard. Default hard [Optional] * @return ORM * @throws Gleez_Exception * @uses Path::delete */ public function delete($soft = FALSE) { if (!$this->_loaded) { throw new Gleez_Exception('Cannot delete :model model because it is not loaded.', array(':model' => $this->_object_name)); } if (is_array($this->_deleted_column) && $soft == TRUE) { } else { $source = $this->rawurl; parent::delete($soft); // Delete the path aliases associated with this object Path::delete(array('source' => $source)); unset($source); } return $this; }