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

Function processManyToMany

packages/sql/src/AbstractSqlDriver.ts:3058–3080  ·  view source on GitHub ↗
(
    meta: EntityMetadata<T>,
    pks: Primary<T>[],
    collections: EntityData<T>,
    clear: boolean,
    options?: DriverMethodOptions,
  )

Source from the content-addressed store, hash-verified

3056 }
3057
3058 protected async processManyToMany<T extends object>(
3059 meta: EntityMetadata<T>,
3060 pks: Primary<T>[],
3061 collections: EntityData<T>,
3062 clear: boolean,
3063 options?: DriverMethodOptions,
3064 ) {
3065 for (const prop of meta.relations) {
3066 if (collections[prop.name]) {
3067 const pivotMeta = this.metadata.get(prop.pivotEntity);
3068 const persister = new PivotCollectionPersister(
3069 pivotMeta,
3070 this,
3071 options?.ctx,
3072 options?.schema,
3073 options?.loggerContext,
3074 pickAbortOptions(options),
3075 );
3076 persister.enqueueUpdate(prop, collections[prop.name] as Primary<T>[][], clear, pks);
3077 await this.rethrow(persister.execute());
3078 }
3079 }
3080 }
3081
3082 override async lockPessimistic<T extends object>(entity: T, options: LockOptions): Promise<void> {
3083 const meta = helper(entity).__meta;

Callers

nothing calls this directly

Calls 5

enqueueUpdateMethod · 0.95
executeMethod · 0.95
pickAbortOptionsFunction · 0.85
rethrowMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected