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


PHP Attachments::deleteByObject方法代码示例

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


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

示例1: delete

 /**
  * Delete document
  * 
  * @param void
  * @return null 
  */
 function delete()
 {
     $filepath = $this->getFilePath();
     db_begin_work();
     $delete = parent::delete();
     if (!$delete || is_error($delete)) {
         db_rollback();
         return $delete;
     }
     // if
     $delete_attachments = Attachments::deleteByObject($this);
     if (!$delete_attachments || is_error($delete_attachments)) {
         db_rollback();
         return $delete_attachments;
     }
     // if
     if (is_file($filepath)) {
         @unlink($filepath);
     }
     // if
     db_commit();
     return true;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:29,代码来源:Document.class.php

示例2: delete

 /**
  * Delete this object
  * 
  * If $drop_subitems is TRUE subitems will be delete from the database. If it 
  * is false relation will be nullified
  *
  * @param boolean $drop_subitems
  * @return boolean
  * @throws DBQueryError
  */
 function delete($drop_subitems = true)
 {
     db_begin_work();
     $delete = parent::delete();
     if (is_error($delete) || !$delete) {
         db_rollback();
         return $delete;
     }
     // if
     $subitems = $this->getSubitems();
     if (is_foreachable($subitems)) {
         foreach ($subitems as $subitem) {
             if ($drop_subitems) {
                 $delete = $subitem->delete();
                 if (is_error($delete)) {
                     db_rollback();
                     return $delete;
                 }
                 // if
             } else {
                 $subitem->setParent(null, false);
                 $save = $subitem->save();
                 if (is_error($save)) {
                     db_rollback();
                     return $save;
                 }
                 // if
             }
             // if
         }
         // foreach
     }
     // if
     StarredObjects::deleteByObject($this);
     // Attachments
     if ($this->can_have_attachments) {
         Attachments::deleteByObject($this);
     }
     // if
     // Subscriptions
     if ($this->can_have_subscribers) {
         Subscriptions::deleteByParent($this);
     }
     // if
     // Asignments
     if ($this->can_have_assignees) {
         Assignments::deleteByObject($this);
     }
     // if
     // Activity log
     if ($this->log_activities) {
         ActivityLogs::deleteByObject($this);
     }
     // if
     // Reminders
     if ($this->can_send_reminders) {
         Reminders::deleteByObject($this);
     }
     // if
     search_index_remove($this->getId(), 'ProjectObject');
     db_commit();
     return true;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:73,代码来源:ProjectObject.class.php


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