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

Method mapResult

packages/sql/src/query/QueryBuilder.ts:2618–2630  ·  view source on GitHub ↗
(row: EntityData<Entity>, map = true)

Source from the content-addressed store, hash-verified

2616 }
2617
2618 private mapResult(row: EntityData<Entity>, map = true): Loaded<Entity, Hint, Fields> {
2619 if (!map) {
2620 return row as Loaded<Entity, Hint, Fields>;
2621 }
2622
2623 const entity = this.em!.map<Entity>(this.mainAlias.entityName, row, {
2624 schema: this.#state.schema,
2625 mapped: true,
2626 }) as Loaded<Entity, Hint, Fields>;
2627 this.propagatePopulateHint(entity as Entity, this.#state.populate);
2628
2629 return entity;
2630 }
2631
2632 private mapResults(res: EntityData<Entity>[], limit?: number): Loaded<Entity, Hint, Fields>[] {
2633 const entities: Loaded<Entity, Hint, Fields>[] = [];

Callers 2

streamMethod · 0.95
mapResultsMethod · 0.95

Calls 2

propagatePopulateHintMethod · 0.95
mapMethod · 0.45

Tested by

no test coverage detected