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

Method createContext

packages/core/src/utils/RequestContext.ts:60–73  ·  view source on GitHub ↗
(
    em: EntityManager | EntityManager[],
    options: CreateContextOptions = {},
  )

Source from the content-addressed store, hash-verified

58 }
59
60 private static createContext(
61 em: EntityManager | EntityManager[],
62 options: CreateContextOptions = {},
63 ): RequestContext {
64 const forks = new Map<string, EntityManager>();
65
66 if (Array.isArray(em)) {
67 em.forEach(em => forks.set(em.name, em.fork({ useContext: true, ...options })));
68 } else {
69 forks.set(em.name, em.fork({ useContext: true, ...options }));
70 }
71
72 return new RequestContext(forks);
73 }
74}
75
76/** Options for creating a new RequestContext, allowing global overrides. */

Callers 2

createMethod · 0.95
enterMethod · 0.95

Calls 2

forkMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected