Skip to main content

JunctionLink

@webda/models


Class: JunctionLink<T, K>

Defined in: packages/models/src/relations.ts:1184

Define a junction link between two models in a n:m relation

This is used to define the junction model in a n:m relation with additional data It does not require to have a symetric relation on the other side

Type Parameters​

T​

T extends Storable

K​

K extends Storable

Implements​

Constructors​

Constructor​

new JunctionLink<T, K>(): JunctionLink<T, K>

Returns​

JunctionLink<T, K>

Properties​

[WEBDA_PRIMARY_KEY]​

[WEBDA_PRIMARY_KEY]: readonly ["linkA", "linkB"]

Defined in: packages/models/src/relations.ts:1185

Define the primary key for your model

Implementation of​

Storable.[WEBDA_PRIMARY_KEY]


linkA​

linkA: ModelParent<T>

Defined in: packages/models/src/relations.ts:1186


linkB​

linkB: ModelLink<K>

Defined in: packages/models/src/relations.ts:1187

Methods​

getPrimaryKey()​

getPrimaryKey(): object

Defined in: packages/models/src/relations.ts:1192

Return the composite primary key (linkA + linkB)

Returns​

object

the composite primary key object

linkA​

linkA: PrimaryKeyType<T>

linkB​

linkB: PrimaryKeyType<K>

Implementation of​

Storable.getPrimaryKey


getUUID()​

getUUID(): string

Defined in: packages/models/src/relations.ts:1203

Return a string UID combining both link keys

Returns​

string

the combined UID string

Implementation of​

Storable.getUUID


load()​

load(params): this

Defined in: packages/models/src/relations.ts:1196

Parameters​

params​

any

Returns​

this

Implementation of​

Storable.load


toProxy()​

toProxy(): JunctionLink<T, K>

Defined in: packages/models/src/relations.ts:1210

Return the proxied version of this model (identity for JunctionLink)

Returns​

JunctionLink<T, K>

this instance