php - Doctrine2 + 软删除作为状态模式

标签 php doctrine-orm soft-delete state-pattern

Doctrine2 文档说软删除行为应该作为状态模式更好地实现,但没有提供该实现的任何示例。

如何使用状态模式实现软删除行为?

最佳答案

我认为他们指的是 filters从 2.2 版开始可用:

The filter functionality works on SQL level. Whether an SQL query is generated in a Persister, during lazy loading, in extra lazy collections or from DQL. Each time the system iterates over all the enabled filters, adding a new SQL part as a filter returns.

DoctrineExtensions图书馆包括一个"soft-delete" behaviour .你可能想看看他们的 implementation详细了解它的工作原理。

关于php - Doctrine2 + 软删除作为状态模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9360137/

相关文章:

php - Yii2 - 嵌套资源最佳实践

javascript - 如何将数组的值输入到我的数据库中

sql - 级联软删除

azure - 如何使用 Powershell 从 Microsoft Azure 恢复已删除的容器?

php - 在 PHP 中读取 zip 文件的最佳方式

debugging - Vim : Debug Commandline scripts 的 PHP 调试器

language-agnostic - DDD : Aggregates and sub-aggregates

azure - 列出软删除的 Azure 存储帐户

doctrine-orm - 以 SQL 方式获取 Doctrine DQL 结果

php - "getResults()"在教义查询中返回什么类型的对象