⚠ 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 using index other than primary key



matbeard
  • profile picture
  • Member

Posted 02 April 2012 - 11:16 AM

How can I set a relation between two tables where the 'base table' field relates to a field other than the primary key in the 'relational table'?

Thanks in advance.

Regards,
Mat

matbeard
  • profile picture
  • Member

Posted 04 April 2012 - 18:31 PM

So I guess this isn't possible? I really just need to know one way or another so I can possibly work around it.

Thanks

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 04 April 2012 - 21:47 PM

For now no it is not, you have to change the library and add this functionality.

matbeard
  • profile picture
  • Member

Posted 05 April 2012 - 12:03 PM

Okay. Thanks for the info. I'll give that a try.

Mat

arif rh
  • profile picture
  • Member

Posted 20 September 2012 - 06:16 AM

I am curious, have matbeard got the solution? because I wanna make that kind relation too. :rolleyes:

arif rh
  • profile picture
  • Member

Posted 20 September 2012 - 23:03 PM

I've tried to set relation using index other than primary key, by modifying these files :
[list=1]
[*]join_relation() in Grocery_Crud_Model.php
[*]get_relation_array(), both in Grocery_Crud_Model.php and Grocery_Crud.php library
[*]set_relation() in Grocery_Crud.php library
[/list]
I add another parameter what I called $join_key, which I used as a index key relation other than primary key. And it works.

bluepicaso
  • profile picture
  • Member

Posted 16 February 2013 - 11:20 AM

I've tried to set relation using index other than primary key, by modifying these files :

  • join_relation() in Grocery_Crud_Model.php
  • get_relation_array(), both in Grocery_Crud_Model.php and Grocery_Crud.php library
  • set_relation() in Grocery_Crud.php library
I add another parameter what I called $join_key, which I used as a index key relation other than primary key. And it works.

could you please share the code