I have event listener as service, declared as:
#[Autoconfigure(shared: true)]
#[AutoconfigureTag(name: 'doctrine.event_listener', attributes: [
'event' => Events::preUpdate,
'entity' => User::class,
'method' => 'preUpdate',
])]
#[AutoconfigureTag(name: 'doctrine.event_listener', attributes: [
'event' => Events::postFlush,
'method' => 'postFlush',
])]
class Sender
Unfortunately, symfony create for preUpdate and postFlush another object, so I cannot used shared this.
What's wrong with it?
Thanks.
source https://stackoverflow.com/questions/71501871/symfony-event-listener-service-shared
No comments:
Post a Comment