@@ -7,7 +7,7 @@ import { assertSingleValue, executeOperation } from "./utils/yoga";
77import gql from "graphql-tag" ;
88import { Book } from "./entities/Book" ;
99import { Author } from "./entities/Author" ;
10- import { EntityDataLoader } from "mikro-orm-find-dataloader" ;
10+ // import { EntityDataLoader } from "mikro-orm-find-dataloader";
1111import { type EntityManager } from "@mikro-orm/core" ;
1212
1313const getAuthorsQuery = gql `
@@ -41,7 +41,7 @@ void (async () => {
4141 await populateDatabase ( em ) ;
4242 em = orm . em . fork ( ) ;
4343
44- const entityDataLoader = new EntityDataLoader ( em ) ;
44+ // const entityDataLoader = new EntityDataLoader(em);
4545
4646 const schema = createSchema ( {
4747 typeDefs : gql `
@@ -68,12 +68,22 @@ void (async () => {
6868 // return await author.books.load();
6969 // return await author.books.load({ dataloader: true });
7070 // return await em.find(Book, { author: author.id });
71- return await entityDataLoader . find ( Book , { author : author . id } ) ;
71+ // return await entityDataLoader.find(Book, { author: author.id });
72+ return await em . getRepository ( Book ) . find ( { author : author . id } , { dataloader : true } ) ;
7273 } ,
7374 } ,
7475 } ,
7576 } ) ;
7677
78+ /*
79+ await em.getRepository(Book).find({}, { populate: ["*"], limit: 2 });
80+ await em.getRepository(Book).find({}, { populate: ["*"] });
81+ await em.getRepository(Book).find({}, { populate: ["*"], limit: 2, dataloader: false });
82+ await em.getRepository(Book).find({}, { populate: ["*"], dataloader: false });
83+ await em.getRepository(Book).find({}, { populate: ["*"], limit: 2, dataloader: true });
84+ await em.getRepository(Book).find({}, { populate: ["*"], dataloader: true });
85+ */
86+
7787 const yoga = createYoga ( { schema } ) ;
7888 const res = await executeOperation ( yoga , getAuthorsQuery ) ;
7989 assertSingleValue ( res ) ;
0 commit comments