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

Method commit

packages/core/src/EntityManager.ts:1712–1727  ·  view source on GitHub ↗

* Commits the transaction bound to this EntityManager. Flushes before doing the actual commit query.

()

Source from the content-addressed store, hash-verified

1710 * Commits the transaction bound to this EntityManager. Flushes before doing the actual commit query.
1711 */
1712 async commit(): Promise<void> {
1713 const em = this.getContext(false);
1714
1715 if (this.#disableTransactions) {
1716 await em.flush();
1717 return;
1718 }
1719
1720 if (!em.#transactionContext) {
1721 throw ValidationError.transactionRequired();
1722 }
1723
1724 await em.flush();
1725 await em.getConnection('write').commit(em.#transactionContext, new TransactionEventBroadcaster(em));
1726 em.#transactionContext = undefined;
1727 }
1728
1729 /**
1730 * Rollbacks the transaction bound to this EntityManager.

Callers

nothing calls this directly

Calls 5

getContextMethod · 0.95
transactionRequiredMethod · 0.80
commitMethod · 0.65
getConnectionMethod · 0.65
flushMethod · 0.45

Tested by

no test coverage detected