This example shows how to log changes, creations and deletions of Basket entity and it's related BasketItem entities to another related BasketTrack entities.
- Copy the
Service
andEventListener
folders to your project. EventListener is the entrypoint. Add to your service.yaml:
services:
# ...
App\EventListener\EntityTrackListener:
tags:
- { name: doctrine.event_listener, event: onFlush }
- Create
config/app/entity_track.yaml
and import the folder byimports
at yourservices.yaml
:
# ...
imports:
- { resource: 'app/' }
- Create your
Basket
andBasketItem
entities which implementTrackableInterface
. - Create
BasketTrack
entity which implementsTrackInterface
. - Edit
BasketTrackHandler
,BasketItemTrackHandler
andTrackHandlers
as you need. - Use
getBasketTrackTitle
method ofBasketTrackHandler
to get track title.