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

Method populate

packages/core/src/entity/WrappedEntity.ts:203–215  ·  view source on GitHub ↗

Loads the specified relations on this entity.

(
    populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false,
    options: EntityLoaderOptions<Entity, Fields> = {},
  )

Source from the content-addressed store, hash-verified

201
202 /** Loads the specified relations on this entity. */
203 async populate<Hint extends string = never, Fields extends string = never>(
204 populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false,
205 options: EntityLoaderOptions<Entity, Fields> = {},
206 ): Promise<Loaded<Entity, Hint>> {
207 if (!this.__em) {
208 throw ValidationError.entityNotManaged(this.entity);
209 }
210
211 // @ts-ignore hard to type
212 await this.__em.populate(this.entity, populate, options);
213
214 return this.entity as Loaded<Entity, Hint>;
215 }
216
217 /** Returns whether this entity has a primary key value set. */
218 hasPrimaryKey(): boolean {

Callers

nothing calls this directly

Calls 2

entityNotManagedMethod · 0.80
populateMethod · 0.65

Tested by

no test coverage detected