⚠ 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

set_relation_n_n across two dbs



jefc_uk
  • profile picture
  • Member

Posted 23 May 2012 - 10:02 AM

Hi,

I wanto to set up a field with relation n to n where the selection table is in a different db from the relation table. The main table (on which I am using set_relation_n_n) is in the same db as the relation table.

Would the best way to do this be to override the get_relation_n_n_selection_array function in the model and add an optional parameter to trigger connection to a different db? Seems like perhaps this is too simple. Any comments welcome. Even if just to say "yep that seems best'!

Cheers,
Geoff

jefc_uk
  • profile picture
  • Member

Posted 23 May 2012 - 15:09 PM

Ugh... Got impatient so went ahead. I think I have this working, but in a VERY ugly way (too ashamed to say how ;) ). Had to override get_field_types, relation_n_n_queries, get_relation_n_n_selection_array and get_relation_n_n_unselected_array.

Basically I'm checking for a specific table name and if found then prefixxing with the other db name... Yuck..

Still very much open to better suggestions!

Cheers,
Geoff