当前位置: 首页>>代码示例>>PHP>>正文


PHP plugins::delete方法代码示例

本文整理汇总了PHP中plugins::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP plugins::delete方法的具体用法?PHP plugins::delete怎么用?PHP plugins::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plugins的用法示例。


在下文中一共展示了plugins::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formDelete

 /**
  * Performs de-population of model :)
  *
  * @param object The base object to save
  * @param string The message to display if successful
  * @return bool
  */
 protected function formDelete(&$object, $deleteMessage = NULL, $deleteEvents = array())
 {
     // Delete data and all relations
     try {
         // Bring out the Gimp.
         $conn = Doctrine_Manager::connection();
         $conn->beginTransaction();
         $this->delete_prepare($object);
         // Allow plugins to process any data related to this object prior to deletion
         if (!plugins::delete($this, $deleteEvents)) {
             throw new Bluebox_Exception('Plugins failed to delete');
         }
         $this->pre_delete($object);
         // Delete this base record
         $object->delete();
         $conn->commit();
         $this->post_delete($object);
         // Success - optionally set a delete message
         if (is_null($deleteMessage)) {
             $displayName = inflector::humanizeModelName(get_class($object));
             message::set($displayName . ' removed!', array('type' => 'success'));
         } else {
             if (!empty($deleteMessage)) {
                 message::set($deleteMessage, array('type' => 'success'));
             }
         }
         $this->delete_succeeded($object);
         return TRUE;
     } catch (Doctrine_Connection_Exception $e) {
         message::set('Doctrine error: ' . $e->getMessage());
     } catch (Bluebox_Exception $e) {
         message::set('Please correct the errors listed below.');
         kohana::log('alert', $e->getMessage());
     } catch (Exception $e) {
         message::set($e->getMessage());
     }
     if ($conn) {
         $conn->rollback();
     }
     $this->delete_failed($object);
     return FALSE;
 }
开发者ID:Jaybee-,项目名称:bluebox,代码行数:49,代码来源:bluebox.php

示例2: restfulDelete

 /**
  * This function preforms the default restful delete,
  * extend this class and redefine if you need different behavoir.
  *
  * @return void
  */
 public function restfulDelete()
 {
     $errorOccured = FALSE;
     kohana::log('debug', 'Attempting a RESTful delete');
     if (empty($_POST['id'])) {
         message::set('No rows where specified for delete', array('type' => 'alert'));
         return;
     }
     $delIDs = explode(',', $_POST['id']);
     $conn = Doctrine_Manager::connection();
     foreach ($delIDs as $delID) {
         $row = Doctrine::getTable($this->baseModel)->find($delID);
         if (!$row) {
             $errorOccured = TRUE;
             message::set('Unable to locate row ' . strtolower($this->baseModel) . ' id ' . $delID . '!');
             continue;
         }
         try {
             Bluebox_Record::setBaseSaveObject($row);
             $conn->beginTransaction();
             plugins::delete($row);
             $row->delete();
             $conn->commit();
             plugins::delete($row, array('custom' => Router::$controller . '.success', 'coreAction' => FALSE, 'core' => FALSE));
             Bluebox_Record::setBaseSaveObject(NULL);
         } catch (Exception $e) {
             $errorOccured = TRUE;
             message::set('Unable to delete ' . strtolower($this->baseModel) . ' id ' . $delID . '! ' . $e->getMessage());
         }
     }
     if (empty($errorOccured)) {
         message::set('Selected record(s) deleted.', array('type' => 'success'));
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:40,代码来源:jgrid.php


注:本文中的plugins::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。