Skip to content

Is there a way to make the makeOne and make functions of the EntityFactory not persist? #3932

Answered by B4nan
squivix asked this question in Q&A
Discussion options

You must be logged in to vote

You could just pass in a fork yourself and never flush it:

const factory = new AuthorFactory(em.fork());
// now the entities will get persisted to that fork, which will never get flushed (unless you use `make` methods).

but it seems em is private

That has no limitations on runtime, its just "typescript private", not "native private", you can always just do (em as any).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@B4nan
Comment options

Answer selected by squivix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants