本文整理汇总了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;
}
示例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;
}