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

Method loadProperty

packages/core/src/entity/Reference.ts:216–222  ·  view source on GitHub ↗

Loads the entity if needed, then returns the value of the specified property.

(
    prop: K,
    options?: LoadReferenceOrFailOptions<TT, P>,
  )

Source from the content-addressed store, hash-verified

214
215 /** Loads the entity if needed, then returns the value of the specified property. */
216 async loadProperty<TT extends T, P extends string = never, K extends keyof TT = keyof TT>(
217 prop: K,
218 options?: LoadReferenceOrFailOptions<TT, P>,
219 ): Promise<Loaded<TT, P>[K]> {
220 await this.loadOrFail(options);
221 return (this.getEntity() as TT)[prop] as Loaded<TT, P>[K];
222 }
223
224 /** Returns whether the underlying entity has been fully loaded from the database. */
225 isInitialized(): boolean {

Callers 2

dataloader.test.tsFile · 0.80

Calls 2

loadOrFailMethod · 0.95
getEntityMethod · 0.95

Tested by

no test coverage detected