Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (39 sloc) 1.46 KB

Define events with subscriber

You can now expose/define your loggable events from your bundle using event subscriber instead of defining in configuration file. What you need to do, define a easy_audit.event_subscriber service implementing Xiidea\EasyAuditBundle\Subscriber\EasyAuditEventSubscriberInterface

1. Write Your AuditLogEventSubscriber class


namespace App\Subscriber;

use Xiidea\EasyAuditBundle\Subscriber\EasyAuditEventSubscriberInterface

class MyAuditLogEventSubscriber implements EasyAuditEventSubscriberInterface
   public function getSubscribedEvents()
           return array(
               "some_resolver" => "some_event",
               "some_other_resolver" => array(


2. Define Subscriber as service

     class: App\Subscriber\MyAuditLogEventSubscriber
         - { name: easy_audit.event_subscriber }

If you want you can optionally define the resolver for the subscribed events like:

     class: App\Subscriber\MyAuditLogEventSubscriber
         - { name: easy_audit.event_subscriber, resolver : your_resolver_service_id }
You can’t perform that action at this time.