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

Method getORM

packages/cli/src/CLIHelper.ts:86–108  ·  view source on GitHub ↗
(
    contextName?: string,
    configPaths?: string[],
    opts: Partial<Options<D>> = {},
  )

Source from the content-addressed store, hash-verified

84 }
85
86 static async getORM<D extends IDatabaseDriver = IDatabaseDriver>(
87 contextName?: string,
88 configPaths?: string[],
89 opts: Partial<Options<D>> = {},
90 ): Promise<MikroORM<D>> {
91 const options = await this.getConfiguration<D>(contextName, configPaths, opts);
92 const settings = this.getSettings();
93 options.set('allowGlobalContext', true);
94 options.set('debug', !!settings.verbose);
95 options.getLogger().setDebugMode(!!settings.verbose);
96
97 if (settings.preferTs !== false) {
98 options.set('preferTs', true);
99 }
100
101 // The only times when we don't care to have a warning about no entities is also the time when we ignore entities.
102 if (opts.discovery?.warnWhenNoEntities === false) {
103 options.set('entities', []);
104 options.set('entitiesTs', []);
105 }
106
107 return MikroORM.init(options.getAll());
108 }
109
110 static async isDBConnected(config: Configuration, reason?: false): Promise<boolean>;
111 static async isDBConnected(config: Configuration, reason: true): Promise<true | string>;

Callers 8

handlerMethod · 0.80
handlerMethod · 0.80
handlerMethod · 0.80
handleSchemaCommandMethod · 0.80
handlerMethod · 0.80
handlerMethod · 0.80
CLIHelper.test.tsFile · 0.80

Calls 6

getSettingsMethod · 0.95
setMethod · 0.65
setDebugModeMethod · 0.65
getLoggerMethod · 0.65
initMethod · 0.65
getAllMethod · 0.65

Tested by

no test coverage detected