⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Joins and relations (again)



José Víctor Ramos Sánchez
  • profile picture
  • Member

Posted 09 December 2012 - 00:12 AM

Hi

I have let's say 4 tables as these:


main
id main_field id_table_two
1 main 1

2 main_other 2

3 main_one_more 3



table_two
id id_table_three id_table_four table_two_text_field
1 1 1 first on table two

2 1 2 second on table two

3 2 1 third on table two

table_three
id table_three_text
1 some text on table three
2 more text on table three

table four
id table_four_text
1 text on table four
2 more text on table four


Using $crud->set_relation I can show a dropdown show the fields from table_two, but two values are just id's.

I would like to show the info also from the relation between table_two with table_three and table_four, so the options in the dropdown it will be:
some text on table three - text on table four - first on table two
some text on table three - more text on table four - second on table two
more text on table three - text on table four - third on table two

I'm pretty sure this it's something about use set_model function, but I can't get it how it should work, I've been looking some post here but didn't understood really well.

Any help ? My best regards !