darkhoros VIP
Total posts: 152
22 Apr 2017 00:28

Hi, I have a realestate website, where I have section for Agents and type agents, and section for properties and type properties, NOW, Agents will have multiple properties and each property belong to one and only one agent.

So when I do the relation, in which type do I add the field relation(child) and which will have field type relation(parent)?

I know the sequance for the creation process but I am not sure which to have parent field and which to have child field.

Thank you. Regards.

Last Modified: 12 Feb 2018


pepperstreet VIP
Total posts: 3,837
23 Apr 2017 00:57

Good question. I would apply the following logic...

1 to many relation
1 Agent = Parent
1 Parent can have multiple Properties = multiple Childs

Create the respective field inside each type:

Parent field in Agent type. (Hence parameter: Limit children per one parent)
Child field in Property type.


Actually it can also work in the other direction or even both ways. But "multiple parents" is an extra option, which has to be enabled in child fields. So, I would stay with the basic default logic. At least this is how I see your relation. It is comparable to Movie -> Reviews.

Hope this helps.


Sergey
Total posts: 13,748
24 Apr 2017 13:15

Exactly. You use Parent field in parent and child field in child.


darkhoros VIP
Total posts: 152
29 Jan 2018 18:45

Hi, Ok I have a starnge situation, I have applied your setup, but when I am at the parent item and I edit that parent record, I can select a child from a multiselect which is already selected in another parent, although in the child record edit view I can only select one parent from single select list, it seems if you edit the parent record it dose not check if that child record is alredy selected in another parent or not.

Is this bug a reality or I am just doing some thing wrong.

Further more in the parent section view, i can use the attach existing button to attache same child for multiple parents using the attach existing button on each of the parents.

Please advice.

Thank you.


Sergey
Total posts: 13,748
12 Feb 2018 13:41

I've checked the code. theer is exception of those child articles. Unfortunately I am not at my developmetn machine and cannot test it, but I'll do as soon as I get there.

Powered by Cobalt