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

Method createCondition

packages/core/src/entity/Collection.ts:462–474  ·  view source on GitHub ↗
(cond: FilterQuery<TT> = {})

Source from the content-addressed store, hash-verified

460 }
461
462 private createCondition<TT extends T>(cond: FilterQuery<TT> = {}): FilterQuery<TT> {
463 if (this.property.kind === ReferenceKind.ONE_TO_MANY) {
464 // the owning FK may reference a non-PK column (`targetKey`), so match on that value when set
465 cond[this.property.mappedBy as unknown as FilterKey<TT>] = helper(this.owner).getTargetKeyValue(
466 this.mappedByProp?.targetKey,
467 ) as any;
468 } else {
469 // MANY_TO_MANY
470 this.createManyToManyCondition(cond);
471 }
472
473 return cond;
474 }
475
476 private createManyToManyCondition<TT extends T>(cond: FilterQuery<TT>) {
477 const dict = cond as Dictionary;

Callers 1

matchingMethod · 0.95

Calls 3

helperFunction · 0.85
getTargetKeyValueMethod · 0.65

Tested by

no test coverage detected