delete() public method

Delete this record from the database
public delete ( )
コード例 #1
0
ファイル: friend.php プロジェクト: Thanandar/GiftCircle
 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;
 }
コード例 #2
0
ファイル: form.php プロジェクト: niiyatii/crowdmap
 /**
  * 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();
 }
コード例 #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);
 }
コード例 #4
0
ファイル: role.php プロジェクト: MenZil-Team/cms
 /**
  * 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;
 }
コード例 #5
0
ファイル: comment.php プロジェクト: natgeo/kids-myshot
 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);
 }
コード例 #6
0
ファイル: provider.php プロジェクト: bqevin/saidika
 /**
  * Overrides the default delete
  */
 public function delete()
 {
     // Delete locations
     // Delete contacts
     // Delete emergencies
     parent::delete();
 }
コード例 #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);
 }
コード例 #8
0
ファイル: User.php プロジェクト: ariol/adminshop
 public function delete($id = NULL)
 {
     if (Auth::instance()->get_user()->id == $this->id || Auth::instance()->get_user()->id == $id) {
         return;
     }
     parent::delete($id);
 }
コード例 #9
0
ファイル: filter.php プロジェクト: rukku/SwiftRiver
 /**
  * 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();
 }
コード例 #10
0
ファイル: group.php プロジェクト: andyst/gallery3
 /**
  * @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);
 }
コード例 #11
0
ファイル: user.php プロジェクト: kandsten/gallery3
 /**
  * @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;
 }
コード例 #12
0
ファイル: table.php プロジェクト: hongster/mWedding
 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();
 }
コード例 #13
0
ファイル: media.php プロジェクト: ZerGabriel/cms-1
 public function delete()
 {
     if (!$this->loaded()) {
         throw new Kohana_Exception('Media not loaded');
     }
     $this->_unlink();
     return parent::delete();
 }
コード例 #14
0
ファイル: permission.php プロジェクト: Dirichi/Ushahidi_Web
 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();
 }
コード例 #15
0
ファイル: pigment.php プロジェクト: HIVE-Creative/spicers
 /**
  * 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);
     }
 }
コード例 #16
0
 public function delete()
 {
     if ((bool) $this->contents->count_all()) {
         foreach ($this->contents->find_all() as $content) {
             $content->delete();
         }
     }
     return parent::delete();
 }
コード例 #17
0
ファイル: registration.php プロジェクト: halkeye/ecmproject
 public function delete()
 {
     $pass_id = $this->pass_id;
     $result = parent::delete();
     if ($result) {
         $this->deleteTicket($pass_id);
     }
     return $result;
 }
コード例 #18
0
ファイル: group.php プロジェクト: JasonWiki/docs
 /**
  * @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;
 }
コード例 #19
0
ファイル: Menu.php プロジェクト: artbypravesh/morningpages
    /**
	 * 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();
            }
コード例 #20
0
ファイル: Version.php プロジェクト: artbypravesh/morningpages
 public function delete()
 {
     try {
         unlink($this->file->path . $this->filename);
     } catch (exception $e) {
         // erh..
     }
     return parent::delete();
 }
コード例 #21
0
ファイル: sheet.php プロジェクト: HIVE-Creative/spicers
 /**
  * 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;
 }
コード例 #22
0
 public function delete()
 {
     $widgets = $this->widgets->find_all();
     if ((bool) $widgets->count()) {
         foreach ($widgets as $widget) {
             $widget->delete();
         }
     }
     return parent::delete();
 }
コード例 #23
0
ファイル: eventlog.php プロジェクト: natgeo/kids-myshot
 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);
 }
コード例 #24
0
ファイル: list.php プロジェクト: Thanandar/GiftCircle
 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();
 }
コード例 #25
0
ファイル: Zest_ORM.php プロジェクト: sydlawrence/SocialFeed
 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();
 }
コード例 #26
0
ファイル: Post.php プロジェクト: modulargaming/forum
 /**
  * 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();
 }
コード例 #27
0
ファイル: tag.php プロジェクト: ultimateprogramer/cms
 /**
  * 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;
 }
コード例 #28
0
ファイル: Role.php プロジェクト: artbypravesh/morningpages
 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();
 }
コード例 #29
0
ファイル: tag.php プロジェクト: viosca/gallery3
 /**
  * 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;
 }
コード例 #30
0
ファイル: tag.php プロジェクト: MenZil-Team/cms
 /**
  * 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;
 }