EasyAuditBundle icon indicating copy to clipboard operation
EasyAuditBundle copied to clipboard

Doctrine ODM namespace error

Open zvirag opened this issue 5 years ago • 5 comments

Hi!

I found an issue in latest beta version. I create AuditLog document extends from Model, but didn't work. This is the error message:

The class 'App\\Document\\AuditLog' was not found in the chain configured namespaces App\\Entity, Xiidea\\EasyAuditBundle\\Entity

Thx

zvirag avatar Jul 02 '19 08:07 zvirag

I encounter this in version 1.4 with this configuration:

# Read the documentation: http://xiidea.github.io/EasyAuditBundle/
xiidea_easy_audit:
    #entity_class: App\Document\AuditLog
    default_logger: true
    user_property: null # or username
    audit_log_class: App\Document\AuditLog
    doctrine_objects:
        App\Document\Services: [created, updated, deleted]

We are attempting to track updates to a Doctrine MongoDB (ODM) document.

cnizzardini avatar Aug 31 '20 16:08 cnizzardini

@cnizzardini @zvirag can you provide any example repository with this issue, so I can test

ronisaha avatar Sep 01 '20 06:09 ronisaha

For this, I have no custom repository, just a Doctrine ODM document for App\Document\Services. I think this library does not look at App\Document. Uses only settings from doctrine.orm and not doctrine_mongodb.

doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'

        # IMPORTANT: You MUST configure your db driver and server version,
        # either here or in the DATABASE_URL env var (see .env file)
        driver: 'postgresql'
        server_version: '12'
    orm:
        auto_generate_proxy_classes: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
        mappings:
            App:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Entity'
                prefix: 'App\Entity'
                alias: App

versus

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
            # metadata_cache_driver: apcu
            #metadata_cache_driver:
            #    type: redis
            #    class: Doctrine\Common\Cache\RedisCache
            #    host: redisdb
            #    port: 6379
            #    instance_class: Redis
            mappings:
                App:
                    is_bundle: false
                    type: annotation
                    dir: '%kernel.project_dir%/src/Document'
                    prefix: 'App\Document'
                    alias: App

cnizzardini avatar Sep 01 '20 13:09 cnizzardini

@cnizzardini Could you please share the App\Document\AuditLog class

ronisaha avatar Sep 05 '20 12:09 ronisaha

It was copied from here: https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/audit-log-entity-orm.md#or-doctrine-odm-document-class @ronisaha

cnizzardini avatar Sep 06 '20 19:09 cnizzardini