1

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?

kristof
  • 129
  • 1
  • 14
  • 2
    I'm looking at using this as well, but finding the documentation pretty poor. How did you add the schema for the "ext_log_entries" database? – Geoff Maddock Mar 19 '18 at 20:04

1 Answers1

2

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.

kristof
  • 129
  • 1
  • 14