2017-01-17 3 views
0

私のSymfonyプロジェクトでは、Gedmo/Loggableプラグインを使用したいと考えています。loggableはデータベースに何もログしません

残念ながら、私はこのプラグインのための明示的なドキュメンテーションを見つけませんでした。 ただ、完全なSTOF \ DoctrineExtensionsBundle \ StofDoctrineExtensionsBundle() https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html

のために私は、データベース内の "ext_log_entries" テーブルを持っています。しかし、エントリーはありません。ログされたエンティティで何かを変更すると、エントリはありません。

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 

エンティティ

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

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

は、誰かが私のミスであり、私を言うことはできますか?

答えて

1

理由を見つけました。

私はチュートリアルのこのステップを見つけることができませんでしたservices.yml

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

にサービスを注入しませんでした。今それは正常に動作します。

関連する問題