loggable doesn't log anything to database

1.6k views Asked by At

In my Symfony project we want to use the Gedmo/Loggable plugin.

Unfortunately I didn't find an documantation explicit for this plugin. Just for the complete Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle() https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html

I have the "ext_log_entries" table in my database. But there no entrys, when I change something on a logged entity.

config.yml:

orm:
    auto_generate_proxy_classes: true #"%kernel.debug%"
    naming_strategy: doctrine.orm.naming_strategy.underscore
    auto_mapping: true


    mappings:
      gedmo_loggable:
          type: annotation
          prefix: Gedmo\Loggable\Entity
          dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
          alias: GedmoLoggable # (optional) it will default to the name set for the mappingmapping
          is_bundle: false

entity

/**
 * company
 *
 * @ORM\Table(name="company")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\companyRepository")
 * @ORM\HasLifecycleCallbacks()
 * 
 * @Gedmo\Loggable
 */
class company 
{

    /**
     * @var string 
     * @Gedmo\Versioned
     */
    private $companyName;
}

Can someone say me, where my mistake is?

1

There are 1 answers

0
kristof On

I found the reason.

I didn't inject the service to the services.yml

  gedmo.listener.loggable:
        class: Gedmo\Loggable\LoggableListener
        tags:
            - { name: doctrine.event_subscriber, connection: default }

Didn't find this step in the tutorial. Now it works fine.