MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / afterFlush

Method afterFlush

tests/issues/GH3737.test.ts:62–72  ·  view source on GitHub ↗
(args: FlushEventArgs)

Source from the content-addressed store, hash-verified

60
61class ProjectUsersSubscriber implements EventSubscriber<ProjectUser> {
62 async afterFlush(args: FlushEventArgs): Promise<void> {
63 const uow = args.uow;
64 const changeSets = uow.getChangeSets().filter(cs => cs.entity instanceof ProjectUser);
65 for (const cs of changeSets) {
66 const pk = cs.getPrimaryKey(true)! as Record<string, unknown>;
67 expect(pk).toBeInstanceOf(Object);
68 expect(Array.isArray(pk)).toBe(false);
69 expect(Object.keys(pk)).toMatchObject(['project', 'user']);
70 expect(Object.values(pk).map(v => typeof v)).toMatchObject(['number', 'number']);
71 }
72 }
73}
74
75let orm: MikroORM;

Callers

nothing calls this directly

Calls 6

filterMethod · 0.80
getChangeSetsMethod · 0.80
getPrimaryKeyMethod · 0.65
keysMethod · 0.45
mapMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected