@@ -7,7 +7,7 @@ import { assertSingleValue, executeOperation } from "./utils/yoga";
7
7
import gql from "graphql-tag" ;
8
8
import { Book } from "./entities/Book" ;
9
9
import { Author } from "./entities/Author" ;
10
- import { EntityDataLoader } from "mikro-orm-find-dataloader" ;
10
+ // import { EntityDataLoader } from "mikro-orm-find-dataloader";
11
11
import { type EntityManager } from "@mikro-orm/core" ;
12
12
13
13
const getAuthorsQuery = gql `
@@ -41,7 +41,7 @@ void (async () => {
41
41
await populateDatabase ( em ) ;
42
42
em = orm . em . fork ( ) ;
43
43
44
- const entityDataLoader = new EntityDataLoader ( em ) ;
44
+ // const entityDataLoader = new EntityDataLoader(em);
45
45
46
46
const schema = createSchema ( {
47
47
typeDefs : gql `
@@ -68,12 +68,22 @@ void (async () => {
68
68
// return await author.books.load();
69
69
// return await author.books.load({ dataloader: true });
70
70
// 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 } ) ;
72
73
} ,
73
74
} ,
74
75
} ,
75
76
} ) ;
76
77
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
+
77
87
const yoga = createYoga ( { schema } ) ;
78
88
const res = await executeOperation ( yoga , getAuthorsQuery ) ;
79
89
assertSingleValue ( res ) ;
0 commit comments