* Adds a join from a property object. Used internally for TPT joins where the property * is synthetic (not in entity.properties) but defined on metadata (e.g., tptParentProp). * The caller must create the alias first via createAlias(). * @internal
(
prop: EntityProperty,
ownerAlias: string,
alias: string,
type: JoinType,
path: string,
schema?: string,
)
| 2989 | * @internal |
| 2990 | */ |
| 2991 | addPropertyJoin( |
| 2992 | prop: EntityProperty, |
| 2993 | ownerAlias: string, |
| 2994 | alias: string, |
| 2995 | type: JoinType, |
| 2996 | path: string, |
| 2997 | schema?: string, |
| 2998 | ): string { |
| 2999 | schema ??= prop.targetMeta?.schema === '*' ? '*' : this.driver.getSchemaName(prop.targetMeta); |
| 3000 | const key = `[tpt]${ownerAlias}#${alias}`; |
| 3001 | this.#state.joins[key] = |
| 3002 | prop.kind === ReferenceKind.MANY_TO_ONE |
| 3003 | ? this.helper.joinManyToOneReference(prop, ownerAlias, alias, type, {}, schema) |
| 3004 | : this.helper.joinOneToReference(prop, ownerAlias, alias, type, {}, schema); |
| 3005 | this.#state.joins[key].path = path; |
| 3006 | return key; |
| 3007 | } |
| 3008 | |
| 3009 | private joinReference( |
| 3010 | field: string | RawQueryFragment | NativeQueryBuilder | QueryBuilder, |
no test coverage detected