Skip to content

RelationshipOneToMany

iraichi edited this page Apr 24, 2015 · 8 revisions

How to define a "has many" reference between models

Please refer to here for general informatios about models.

If you want to define a "has many" reference between models you are creating a Master/Detail relationship. You have to operate in both master and detail model:

  • Master model: define the DetailReferences node
  • Detail model: define a reference field that points back to the master model.

Example from HelloKitto:

# Party.yaml
ModelName: Party
...
DetailReferences:
  Invitation: Invitation

# Invitation.yaml
ModelName: Invitation
Fields:
...
  Party: Reference(Party) not null
    Fields:
      Party_Id:

Clone this wiki locally