DeuxHuitHuit / entry_relationship_field

A new way to create master-details pattern with Symphony's sections
http://symphonyextensions.com/extensions/entry_relationship_field/
Other
11 stars 12 forks source link

Bi-directional relationships #43

Closed designermonkey closed 6 years ago

designermonkey commented 9 years ago

As discussed, I would like to propose that we modify the field to be able to see other Entry Relationship Fields in linked sections.

The scenario to work on is:

entry_relationships

How could we do this...? These are just some ideas...

Correct me if I'm wrong though...

designermonkey commented 9 years ago

@nitriques, @psychoticmeow

nitriques commented 9 years ago

I think that there maybe should be a single row for each relationship rather than a comma separated list in the field table.

Where ? In the data table ? Or in sections_association ?

When a relationship is created in a field with the bi-directional option, a partner relationship should be generated in the other fields table.

Could you expand on this idea please ?

And think about that, currently, you could filter by child entry id, so you'll get all of its parent... (this could be plan B)

designermonkey commented 9 years ago

In the field entries data table, there's only two columns, one for the entry ID, and another for all the other entry IDs. In a Tag List field, for example, they are all separate rows, which means the same ID multiple times in one column.

currently:
id, entry_id, entries
'20', '4', '1,2,3'

could be:
id, entry_id, related_entry_id
'20', '4', '1'
'21', '4', '2'
'22', '4', '3'

Could you expand on this idea please ?

By all means :)

So, when I link to an entry in a section that has another 'bi-directional' entry relationship field, an entry is created in the data table for this field, and it should create one in the other section's entry relationship field's data table too, like mirroring the relationship.

I just thought that this could be a quick and easy way to show the bi-directional status of an entry. This would rely on the single row for each relationship though.

nitriques commented 9 years ago

Ok cool. But how would you display this relationship in the child entry ? There would be a dedicated, non editable field in the child ?

designermonkey commented 9 years ago

No, I'm not thinking like that. You wouldn't display the child relationship, as there would be two parent fields, and therefore two parent -> child relationships, if we were to mirror the relationship in each field.

I'm thinking like the bi-link field worked.

nitriques commented 9 years ago

Ok. So the relationship changes according to the point of view, i.e., I say A is parent of B but you could also say that B is parent of A ? (it's the same link, created once?...)

designermonkey commented 9 years ago

I think so?? ;P

I've never really been comfortable with the whole parent < child relationship structure, all because of fields having to exist in one of the sections, so if we could make it that both sections could control the relationship, then we're on a winner.

Of course this would mean fudging it a little, as we still have to maintain the 'field in a section' thing. So, having the field in both sides of the relationship, and able to mirror the other side's relationships is that fudge.

But hey, this is only an idea and if it's better done another way... then ignore it.

nitriques commented 9 years ago

Ok great guys I think we are making progress...

I like what @psychoticmeow wrote a lot. But this would require us to create a field in x sections: the one you are editing and one for each "linked" section am I right ?

nitriques commented 9 years ago

Can't wait to see the code ;)

But are you not able to not create new tables ? (just using the core ones ?)

designermonkey commented 9 years ago

the only thing I see as an issue here, is that at least one section must always be defined as left, and many others as right.

Could we not just make sections part of an association?

and have multiple references to the same association_id?

EDIT:

Meaning, we just create an association in Symphony, and attach sections to it, instead of picking the left and right?

nitriques commented 9 years ago

@designermonkey I like that...

designermonkey commented 9 years ago

Awesome-sauce.

I would definitely keep all this as extensions so we leave the core associations alone for now.

designermonkey commented 9 years ago

I'm easy either way.

brendo commented 9 years ago

FYI that patch has been applied so you're free to continue to explore this. Happy to leave this with you guys at the moment, simply because I'm a bit swamped at the moment to focus on another thing.

At a very high level though, I agree. Something has to change to allow us to better describe and interact with entry/section relationships. After trying to fix various things with Associations (which was a positive step forward in many ways!), it's clear that it's probably time for a complete rethink instead of continuing to build on existing code.

nitriques commented 9 years ago

but don't let us hold you up on releasing that.

Great! I'd love to see if we can find a merging process when your extension is more mature...

nitriques commented 9 years ago

Hi guys! Is the work still under go ?

designermonkey commented 9 years ago

Yes, we just have to split what we've done out of the project we're on.

nitriques commented 9 years ago

Ok great! In the mean time, I've finally release 1.0.2 which was long overdue.

Next releases will be more frequents.

nitriques commented 7 years ago

We now have "reverse relationship field" which would be able to do it!

nitriques commented 6 years ago

Released as 2.0.0