Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Rootes's avatar

Three Relationships between Two Tables

Hello, Sorry but I can not find this in the forum maybe im not using the right words because I'm quite new in all this. Lets say that I have two tables (Food and Combos) Food contains -- List of all the food Combos contains two options of food (id, Food1, Food2), Do I have to call food with HasOne or HasOneToMany?

0 likes
4 replies
EventFellows's avatar

Can you make an example.

is food equivalent to 'a meal someone can order' or rather like 'an ingredient that can be in many kinds of food'?

Rootes's avatar

Lets see if I can explain it a bit better.. FoodTable => (Id, Name,) MealTable => (Id, FoodTable.name1, FoodTable.name2)

I did a relationship between the FoodTable and Col.name1 but when i thy to do the same with the Col.name2 is crashing.

EventFellows's avatar

Show us some code (please use markup - link below the input field) and what error you get.

Please or to participate in this conversation.