lekoala/silverstripe-softdelete
Composer 安装命令:
composer require lekoala/silverstripe-softdelete
包简介
Soft delete extension for SilverStripe
关键字:
README 文档
README
Add a soft delete behaviour to your dataobjects. Objects are simply marked as deleted and kept in the database.
Soft delete will follow the same permissions patterns as delete.
ModelAdmin and SecurityAdmin are extended to add a new GridField action that replace the default delete action
This module depends on lekoala/silverstripe-cms-actions for displaying delete buttons
How to use
Simply replace your calls from delete to softDelete.
New extensions hooks are provided to avoid side effects (onBeforeSoftDelete, onAfterSoftDelete). These are ideals if you have child records that need to be soft deleted with their parent.
Config options
SilverStripe\Admin\ModelAdmin: softdelete_from_list: true softdelete_from_list_exclude: [] extensions: - SoftDeleteModelAdmin SilverStripe\Admin\SecurityAdmin: softdelete_from_list: true softdelete_from_list_exclude: [] extensions: - SoftDeleteSecurityAdmin
You can configure:
- softdelete_from_list: show delete button on a line. Enabled by default.
- softdelete_from_list_exclude: hide the delete button for these classes even if enabled globally
Prevent accidental deletion
By default, the module will prevent any delete from happening. To allow deletion, you must set
SoftDeletable:$prevent_delete = false
The only way from the CMS UI to delete a record is to go to a soft deleted record and click "Really delete" which will call "forceDelete" on the record.
Disable filtering
You can disable filtering globally, using
SoftDeletable::$disable = true
Or at query level
$dataQuery->setQueryParam('SoftDeletable.filter',false)
Filtering on ids
By default, this module will let you return soft deleted records if you ask them specifically by ID. This is by design to prevent things breaking accidentally. If you want to make sure you don't display soft deleted records, make sure to implement a proper canView() method that fits your usage.
An alternative option, is to disable that feature:
SoftDeletable: check_filters_on_id: false
Keep in mind that DataObject::get_by_id(); can get cached and it can lead to tricky scenarios.
Compatibility
Tested with 6.x
For SilverStripe 5 or Silverstripe 4, please use version 3.x of this module.
Maintainer
LeKoala - thomas@lekoala.be
lekoala/silverstripe-softdelete 适用场景与选型建议
lekoala/silverstripe-softdelete 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 238.61k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2016 年 07 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「module」 「silverstripe」 「delete」 「soft」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lekoala/silverstripe-softdelete 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lekoala/silverstripe-softdelete 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lekoala/silverstripe-softdelete 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
SoftDelete plugin for CakePHP
Laravel console command for deleting temp files and associated model instances.
Analytics chooser extensions for site settings.
CitaNZ's SilverStripe picture object and field for SilverStripe 4
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
统计信息
- 总下载量: 238.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-13