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

Function findTPTChildAlias

packages/sql/src/AbstractSqlDriver.ts:2774–2782  ·  view source on GitHub ↗

* Find the alias for a TPT child table in the query builder. * @internal

(qb: AnyQueryBuilder<T>, childMeta: EntityMetadata)

Source from the content-addressed store, hash-verified

2772 * @internal
2773 */
2774 protected findTPTChildAlias<T extends object>(qb: AnyQueryBuilder<T>, childMeta: EntityMetadata): string | undefined {
2775 const joins = qb.state.joins as Dictionary;
2776 for (const key of Object.keys(joins)) {
2777 if (joins[key].table === childMeta.tableName && key.includes('[tpt]')) {
2778 return joins[key].alias;
2779 }
2780 }
2781 return undefined;
2782 }
2783
2784 /**
2785 * Builds a CASE WHEN expression for TPT discriminator.

Callers

nothing calls this directly

Calls 1

keysMethod · 0.45

Tested by

no test coverage detected