⚠ 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 where 'field' = current primary key



jefc_uk
  • profile picture
  • Member

Posted 22 June 2012 - 09:05 AM

Hi,

I am trying to set a relation but I want to filter the results from the relation table based on the value of the primary key in the source table. I thought I could use get_primary_key() in some way but have hit a dead end with it.

By way of illustration;

[size=3][font=courier new,courier,monospace]source_table
source_id, relation_field

relation_table
relation_id, relation_name[/font][/size]

I want something like this on source_table;

$this->grocery_crud->set_relation(
'relation_field',
'relation_table',
'relation_name',
array('relation_id' => source_id)
);


Hope this makes sense! Thanks in advance.

Cheers,
Geoff