Reputation: 459
I'm currently testing Parse and I faced to some issues / challenges. Assume that I have (its just for an example), on my phone, 3 screens:
I'm wondering how to configure Parse database to have the link between the database/class: - having one class for all the menu, one class for all the recipes and one class with all the ingredients where there is a link between the menu, the linked recipes to it and the the linked ingredients to the recipes ?
I was thinking to a Pointer but I don't know how to link to specific database to display the right menu with the right recipes with the right ingredients.
Thank you
Regards
Upvotes: 0
Views: 37
Reputation: 119021
Look towards relationships instead of pointers. Pointers are 'to-one' where as relationships are 'to-many' and each of your classes has many associated others. I.e. 1 Menu
has many Recipe
s, each Recipe
has many Ingredients
.
For your ingredients, consider also that you have an Ingredient
, but you also have an amount of that ingredient. Ingredient
s can be reused across recipes (and you may want to do that so you can query all the recipes which include one or more ingredients), but amounts aren't really reusable. So, you may actually want an IngredientAmount
class so your Recipe
has a relationship to IngredientAmount
s and each IngredientAmount
has a pointer to the associated Ingredient
.
Upvotes: 2