basster/doctrine-elastica-loggable-extension

This library utilizes Gedmo Loggable Doctrine Extension to persist the entity changes into elasticsearch via elastica.io.

2.0 2018-01-30 14:44 UTC

This package is auto-updated.

Last update: 2024-11-20 22:30:12 UTC


README

SensioLabsInsight Scrutinizer Code Quality Code Coverage Build Status

This library utilizes Gedmo Loggable Doctrine Extension to persist the entity changes into elasticsearch via elastica.io.

To make it work in Symfony with Doctrine Extentions Bundle place the following config in your services.yml:

# services.yml

services:
    # overwrite DoctrineExtensionsBundle default listener to inject the ElasticaLoggableListener 
    Stof\DoctrineExtensionsBundle\EventListener\LoggerListener:
      arguments:
        - '@Basster\ElasticaLoggable\Listener\ElasticaLoggableListener'
        - '@security.token_storage'
        - '@security.authorization_checker'
      public: true
      tags:
        - {name: kernel.event_subscriber}

    # register the ElasticaLoggableListener as a service in your application
    Basster\ElasticaLoggable\Listener\ElasticaLoggableListener:
      public: true
      arguments: ['@elastica.type.activity']
      calls:
        - [setAnnotationReader, ['@annotation_reader']]
      tags:
        - { name: doctrine.event_subscriber, connection: default }

    # overwrite doctrine extension service aliases
    stof_doctrine_extensions.event_listener.logger: '@Basster\ElasticaLoggable\Listener\ElasticaLoggableListener'
    stof_doctrine_extensions.listener.loggable: '@Basster\ElasticaLoggable\Listener\ElasticaLoggableListener'