Closed xy02 closed 8 years ago
A model can't have two different relation types to the same model
For belongsTo
LinearLayout.belongsTo(View, 'name of field', 'FK to LinearLayout', 'PK of View');
ImageView.belongsTo(View, 'name of field', 'FK to ImageView', 'PK of View');
For hasMany
LinearLayout.hasMany(View, 'name of field', 'PK of LinearLayout', 'FK to View');
@vmarcel thanks! then how to design the schema of polymorphic type? (we know LinearLayout and ImageView extend View, and LinearLayout contains many Views)
There's no polymorphic type in thinky. As for the questions about relations I think @vmarcel answered it.
Question
Now I have a data about Android Views:
one LinearLayout or ImageView instance only belongsTo one instance of View (is relation 1-1 ?) one LinearLayout instance contains many items of View (1-n?) how to define their schema and relations exactly? thanks a lot