當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CEvent::overrideDatabase方法代碼示例

本文整理匯總了PHP中CEvent::overrideDatabase方法的典型用法代碼示例。如果您正苦於以下問題:PHP CEvent::overrideDatabase方法的具體用法?PHP CEvent::overrideDatabase怎麽用?PHP CEvent::overrideDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CEvent的用法示例。


在下文中一共展示了CEvent::overrideDatabase方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: hook_postDelete

 protected function hook_postDelete()
 {
     $q = $this->_getQuery();
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_project = ' . $this->_old_key);
     $tasks_to_delete = $q->loadColumn();
     $q->clear();
     $task = new w2p_Actions_BulkTasks();
     $task->overrideDatabase($this->_query);
     foreach ($tasks_to_delete as $task_id) {
         $task->task_id = $task_id;
         $task->delete();
     }
     $q->clear();
     $q->addTable('files');
     $q->addQuery('file_id');
     $q->addWhere('file_project = ' . $this->_old_key);
     $files_to_delete = $q->loadColumn();
     $q->clear();
     $file = new CFile();
     $file->overrideDatabase($this->_query);
     foreach ($files_to_delete as $file_id) {
         $file->file_id = $file_id;
         $file->delete();
     }
     $q->clear();
     $q->addTable('events');
     $q->addQuery('event_id');
     $q->addWhere('event_project = ' . $this->_old_key);
     $events_to_delete = $q->loadColumn();
     $q->clear();
     $event = new CEvent();
     $event->overrideDatabase($this->_query);
     foreach ($events_to_delete as $event_id) {
         $event->event_id = $event_id;
         $event->delete();
     }
     $q->clear();
     // remove the project-contacts and project-departments map
     $q->setDelete('project_contacts');
     $q->addWhere('project_id =' . $this->_old_key);
     $q->exec();
     $q->clear();
     $q->setDelete('project_departments');
     $q->addWhere('project_id =' . $this->_old_key);
     $q->exec();
     $q->clear();
     $q->setDelete('tasks');
     $q->addWhere('task_represents_project =' . $this->_old_key);
     parent::hook_preDelete();
 }
開發者ID:victorrod,項目名稱:web2project,代碼行數:52,代碼來源:projects.class.php

示例2: delete

 public function delete()
 {
     $result = false;
     if ($this->_perms->checkModuleItem($this->_tbl_module, 'delete', $this->{$this->_tbl_key})) {
         $q = $this->_getQuery();
         $q->addTable('tasks');
         $q->addQuery('task_id');
         $q->addWhere('task_project = ' . (int) $this->project_id);
         $tasks_to_delete = $q->loadColumn();
         $q->clear();
         $task = new CTask();
         $task->overrideDatabase($this->_query);
         foreach ($tasks_to_delete as $task_id) {
             $task->task_id = $task_id;
             $task->delete();
         }
         $q->clear();
         $q->addTable('files');
         $q->addQuery('file_id');
         $q->addWhere('file_project = ' . (int) $this->project_id);
         $files_to_delete = $q->loadColumn();
         $q->clear();
         $file = new CFile();
         $file->overrideDatabase($this->_query);
         foreach ($files_to_delete as $file_id) {
             $file->file_id = $file_id;
             $file->delete();
         }
         $q->clear();
         $q->addTable('events');
         $q->addQuery('event_id');
         $q->addWhere('event_project = ' . (int) $this->project_id);
         $events_to_delete = $q->loadColumn();
         $q->clear();
         $event = new CEvent();
         $event->overrideDatabase($this->_query);
         foreach ($events_to_delete as $event_id) {
             $event->event_id = $event_id;
             $event->delete();
         }
         $q->clear();
         // remove the project-contacts and project-departments map
         $q->setDelete('project_contacts');
         $q->addWhere('project_id =' . (int) $this->project_id);
         $q->exec();
         $q->clear();
         $q->setDelete('project_departments');
         $q->addWhere('project_id =' . (int) $this->project_id);
         $q->exec();
         $q->clear();
         $q->setDelete('tasks');
         $q->addWhere('task_represents_project =' . (int) $this->project_id);
         $q->clear();
         if ($msg = parent::delete()) {
             return $msg;
         }
         return true;
     }
     return $result;
 }
開發者ID:,項目名稱:,代碼行數:60,代碼來源:


注:本文中的CEvent::overrideDatabase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。