本文整理汇总了PHP中ORM::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::delete方法的具体用法?PHP ORM::delete怎么用?PHP ORM::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
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: delete
/**
* 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: 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);
}
示例4: delete
/**
* 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: delete
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: delete
/**
* Overrides the default delete
*/
public function delete()
{
// Delete locations
// Delete contacts
// Delete emergencies
parent::delete();
}
示例7: 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);
}
示例8: delete
public function delete($id = NULL)
{
if (Auth::instance()->get_user()->id == $this->id || Auth::instance()->get_user()->id == $id) {
return;
}
parent::delete($id);
}
示例9: delete
/**
* 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: 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);
}
示例11: delete
/**
* @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: delete
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: delete
public function delete()
{
if (!$this->loaded()) {
throw new Kohana_Exception('Media not loaded');
}
$this->_unlink();
return parent::delete();
}
示例14: 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();
}
示例15: 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);
}
}