admin管理员组

文章数量:1297014

Does anyone have any information on how to turn on softdeleteable for MongoDB Documents in Symfony?

I see the classes are present in the library, and I tried to turn them on, but everything immediately hard deletes from database.

Does anyone have any direction or dev roadmap on when this feature is expected to work in mongodb/ODM?

doctrine_mongodb:
    auto_generate_proxy_classes: true
    auto_generate_hydrator_classes: true
    connections:
        default:
            server: '%env(resolve:MONGODB_URL)%'
            options: {}
    default_database: '%env(resolve:MONGODB_DB)%'
    document_managers:
        default:
            auto_mapping: true
            mappings:
                App:
                    dir: '%kernel.project_dir%/src/Document'
                    prefix: 'App\Document'
                loggable:
                    type: attribute # or annotation
                    alias: GedmoLoggable
                    prefix: Gedmo\Loggable\Document
                    dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Loggable/Document"
                    is_bundle: false
            filters:
                softdeleteable:
                    class: Gedmo\SoftDeleteable\Filter\ODM\SoftDeleteableFilter
                    enabled: true
# stof_doctrine_extensions.yaml
stof_doctrine_extensions:
    default_locale: en_US
    mongodb:
        default:
            timestampable: true
            blameable: true
            softdeleteable: true
            loggable: true

Added to Document with the deletedAt field.

#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]

本文标签: odmSoftDeleteable documents in Doctrine MongoDB in SymfonyStack Overflow