stof_doctrine_extensions 无法在 symfony 中加载

stof_doctrine_extensions can't load in symfony

我正在尝试为一个 symfony 项目做一个 "soft-delete"。所以我想使用 StofDoctrineExtensionsBundle 并且我做到了:

stof_doctrine_extensions:
    orm:
        default:
            ...
            softdeleteable: true

doctrine:
    ...
    orm:
        filters:
            softdeleteable:
                class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
                enabled: true

在我的 config.yml.

但现在我收到错误消息:

Unrecognized option "softdeleteable" under "doctrine.orm.entity_managers.filters"

在错误消息中,您 post 似乎将键 filters 放在 entity_managers 键下(如消息所述:under "doctrine.orm.entity_managers.filters")。修复在 orm 键下移动过滤器部分,例如:

doctrine:
    orm:
        filters:
            softdeleteable:
                class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
                enabled: true

希望对您有所帮助