Symfony 6 + Gedmo Loggable: Unable to use without MongoDB (use another db)

398 Views Asked by At

I want to use revisions on my entities. I am using Symfony 6 with Doctrine ORM. Doctrine is configured to use MSSQL and works just fine with other entities not using Gedmo - it is tested and it works.

But when I try to add Gedmo Loggable, like this:

composer require gedmo/doctrine-extensions
....
Using version ^3.11 for gedmo/doctrine-extensions

Or this:

composer require stof/doctrine-extensions-bundle
...
behat/transliterator (v1.5.0)
gedmo/doctrine-extensions (v3.11.1)
stof/doctrine-extensions-bundle (v1.7.1)

I add my mapping to my ORM which uses MSSQL:

            gedmo_loggable:
                type: annotation
                prefix: Gedmo\Loggable
                dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Loggable"
                alias: GedmoLoggable
                is_bundle: false

Then i run

php bin/console make:migration

Error:

[critical] Error thrown while running command "make:migration". Message: "Class "Doctrine\ODM\MongoDB\Repository\DocumentRepository" not found"

In LogEntryRepository.php line 24:

  Attempted to load class "DocumentRepository" from namespace "Doctrine\ODM\MongoDB\Repository".
  Did you forget a "use" statement for another namespace?

Is it even possible to use Gedmo without MongoDB? How? I am confused as I cannot find any mention about it being for Mongo solely... And I also recall using it few years back. Has something changed?

1

There are 1 best solutions below

2
On

The error is in the directory item, you should add the folder "/Entity " :

gedmo_loggable:
    type: annotation
    prefix: Gedmo\Loggable
    dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Loggable/Entity"
    alias: GedmoLoggable
    is_bundle: false