-
Johannes Hörmann authoredJohannes Hörmann authored
Object Relation
(how it works currently 13.03.2019)
1. How the ObjectRelation_entity works
The entity works with the AB_OBJECTRELATION and AB_OBJECTRELATIONTYPE db-tables.
The AB_OBJECTRELATIONTYPE defines which relations are possible. It always defines one "side" of the relation. So for each relation you always need two of them and both have to be from the same RELATION_TYPE.
So for example if you would like to have a relation between a child and parent you need these two types:
AB_OBJECTRELATIONTYPEID = UID_1 OBJECT_TYPE = Person RELATION_TITLE = child of RELATION_TYPE = TypeUID_1 SIDE = 1 and AB_OBJECTRELATIONTYPEID = UID_2 OBJECT_TYPE = Person RELATION_TITLE = parent of RELATION_TYPE = TypeUID_1 SIDE = 2
Note that the RELATION_TYPE is the same.
If you create a new relation between two persons it looks like this:
AB_OBJECTRELATIONID = RelUID_1 OBJECT1_ROWID = UID_Lisa_Sommer OBJECT2_ROWID = UID_Franz_Mueller AB_OBJECTRELATIONTYPE1 = UID_1 AB_OBJECTRELATIONTYPE2 = UID_2
→ So:
-
Most relationtypes consist of two separate types connected by the RELATION_TYPE-id
-
Each type also has a SIDE, which defines, if it is for side 1 or side 2
-
If both sides are from the same type, then there is only one OBJECTRELATIONTYPE with the side 1 and Objects use the same one.
The provider use the targetContext-feature to show the preview of the linked objects directly. (see targetContext-docu in the ohers/guide folder)