delete() public method

Delete this record from the database
public delete ( )
Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 /**
  * 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();
 }
Ejemplo n.º 3
0
 /**
  * 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);
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 /**
  * Overrides the default delete
  */
 public function delete()
 {
     // Delete locations
     // Delete contacts
     // Delete emergencies
     parent::delete();
 }
Ejemplo n.º 7
0
 public function delete($id = NULL)
 {
     $post = ORM::factory('blog_post', (int) $this->blog_post_id);
     $post->comment_count -= 1;
     $post->save();
     parent::delete($id);
 }
Ejemplo n.º 8
0
 public function delete($id = NULL)
 {
     if (Auth::instance()->get_user()->id == $this->id || Auth::instance()->get_user()->id == $id) {
         return;
     }
     parent::delete($id);
 }
Ejemplo n.º 9
0
 /**
  * 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();
 }
Ejemplo n.º 10
0
 /**
  * @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);
 }
Ejemplo n.º 11
0
 /**
  * @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;
 }
Ejemplo n.º 12
0
 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();
 }
Ejemplo n.º 13
0
 public function delete()
 {
     if (!$this->loaded()) {
         throw new Kohana_Exception('Media not loaded');
     }
     $this->_unlink();
     return parent::delete();
 }
Ejemplo n.º 14
0
 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();
 }
Ejemplo n.º 15
0
 /**
  * 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);
     }
 }
Ejemplo n.º 16
0
 public function delete()
 {
     if ((bool) $this->contents->count_all()) {
         foreach ($this->contents->find_all() as $content) {
             $content->delete();
         }
     }
     return parent::delete();
 }
Ejemplo n.º 17
0
 public function delete()
 {
     $pass_id = $this->pass_id;
     $result = parent::delete();
     if ($result) {
         $this->deleteTicket($pass_id);
     }
     return $result;
 }
Ejemplo n.º 18
0
 /**
  * @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;
 }
Ejemplo n.º 19
0
    /**
	 * 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();
            }
Ejemplo n.º 20
0
 public function delete()
 {
     try {
         unlink($this->file->path . $this->filename);
     } catch (exception $e) {
         // erh..
     }
     return parent::delete();
 }
Ejemplo n.º 21
0
 /**
  * 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;
 }
Ejemplo n.º 22
0
 public function delete()
 {
     $widgets = $this->widgets->find_all();
     if ((bool) $widgets->count()) {
         foreach ($widgets as $widget) {
             $widget->delete();
         }
     }
     return parent::delete();
 }
Ejemplo n.º 23
0
 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);
 }
Ejemplo n.º 24
0
 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();
 }
Ejemplo n.º 25
0
 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();
 }
Ejemplo n.º 26
0
 /**
  * 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();
 }
Ejemplo n.º 27
0
 /**
  * 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;
 }
Ejemplo n.º 28
0
 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();
 }
Ejemplo n.º 29
0
 /**
  * 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;
 }
Ejemplo n.º 30
0
 /**
  * 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;
 }