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

Function getReferences

tests/features/dataloader/dataloader.test.ts:216–229  ·  view source on GitHub ↗
(em: MikroORM['em'])

Source from the content-addressed store, hash-verified

214}
215
216function getReferences(em: MikroORM['em']): Ref<any>[] {
217 const forkedEm = em.fork();
218 return [
219 ...[1, 2].map(id => forkedEm.getReference(Author, id, { wrapped: true })),
220 ...[5, 3, 4].map(id => forkedEm.getReference(Book, id, { wrapped: true })),
221 ...(
222 [
223 [1, 2],
224 [1, 3],
225 [3, 1],
226 ] as const
227 ).map(pk => forkedEm.getReference(Chat, pk, { wrapped: true })),
228 ] as Ref<any>[];
229}
230
231async function getCollections(em: MikroORM['em']): Promise<Collection<any>[]> {
232 const authors = await em.find(Author, {}, { first: 3, orderBy: { id: QueryOrder.ASC } });

Callers 2

dataloader.test.tsFile · 0.85
getRefsFunction · 0.85

Calls 3

forkMethod · 0.80
mapMethod · 0.45
getReferenceMethod · 0.45

Tested by

no test coverage detected