You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When i register the subscriber manually using em.getEventManager().registerSubscriber(this) the event handlers are not called when events are happening in a transactional callback.
Instantiate the service (either manually or by NestJS)
"subscribed" is logged, but "onFlush" is not.
Expected behavior
Event handlers should be called and onFlush
Additional context
I figured out that in EntityManager.ts, there is this code:
// in transactional:constfork=em.fork({clear: false,// state will be merged once resolvesflushMode: options.flushMode,freshEventManager: true,});//in fork:consteventManager=options.freshEventManager ? newEventManager(em.config.get('subscribers')) : em.eventManager;
which means that the fresh event manager uses subscribers from config, but ignores subscribers registered via registerSubscriber()
Versions
Dependency
Version
node
16.13.2
typescript
4.6.2
mikro-orm
5.4.2
your-driver
postgresql
The text was updated successfully, but these errors were encountered:
Describe the bug
When i register the subscriber manually using
em.getEventManager().registerSubscriber(this)
the event handlers are not called when events are happening in a transactional callback.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Event handlers should be called and onFlush
Additional context
I figured out that in EntityManager.ts, there is this code:
which means that the fresh event manager uses subscribers from config, but ignores subscribers registered via registerSubscriber()
Versions
The text was updated successfully, but these errors were encountered: