4

I'd like to manually populate the relationships table with some data.

I can see the structure of the exp_relationships table, which relates parent_entries to children.

However, for a custom field set that has multiple relationships, I cannot see how EE ties the relationships to each custom relationship field.

It looks like there was a handy wiki for this exact task linked from here which EL have removed in the recent reshuffle: http://ellislab.com/forums/viewthread/165752/

Other than populating the exp_relationships table, how can I relate those relationships to specific custom fields?

EDIT: Oh man - I cannot believe I've been so stupid - of course the relationship ID is tied to the relevant CF column in exp_channel_data!

5

I know you sorted this out, but for others who may wind up here looking for details:

Say you have an entry with an entry_id of 10. That entry's channel has a Relationship field with a field_id of 20.

While editing that entry, you choose a child entry from your Relationship field, which has an entry_id of 50.

You'll end up with these values in your database:

exp_relationships
rel_id: 1 (incremental number generated each time a new relationship is created)
rel_parent_id: 10 (the entry you were editing)
rel_child_id: 50 (the entry you chose in the Relationship field)

exp_channel_data
entry_id: 10 (the entry you were editing)
field_id_20: 1 (the rel_id that was created above)

| improve this answer | |
  • For the record, posting a solution and accepting your own answer is totally fine (you won't earn rep from it anyway). In this case Derek's answer is much more thorough though. – Adrian Macneil Jan 5 '13 at 3:33
1

Oh man - I cannot believe I've been so stupid - of course the relationship ID is tied to the relevant CF column in exp_channel_data!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.