⚠ 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 between table to a view



Milfriosc
  • profile picture
  • Member

Posted 10 November 2016 - 15:49 PM

Hello,

 

I already see that it's possible to set primary key to make crud for a view but I want to make crud from a table and use set relation with a view.

...
$crud->set_table('my_table');
$crud->columns('id','name','fk_streetcode');
$crud->set_primary_key('id_street','my_view');
$crud->set_relation('fk_streetcode','my_view','streetname',null,'streetname ASC');
...

with this definition there's an data base error

 ... JOIN "my_view" as "j447c7032" ON "j447c7032". = "my_table"."fk_streetcode" ...

you can see that the primary key for the view is not define  : there is a point without id_street >> "j447c7032". =

 

sorry for my english ....

 

Thank's for your answers


Athar
  • profile picture
  • Member

Posted 13 January 2017 - 15:14 PM

seems like your (relating) fields are NOT "identical" in both tables.


Amit Shah
  • profile picture
  • Member

Posted 18 January 2017 - 02:24 AM

Hi Milfriosc

Can you dhare the table structure for both so some1 can look @it and suggest you the proper stuff?