⚠ 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

Is it possible to use grocery_CRUD to display data from a view?



kenilik
  • profile picture
  • Member

Posted 16 December 2012 - 01:05 AM

Traditionally I have made pretty heavy use of views in my databases to denormalise data to display to users.

Is it possible to use grocery_CRUD to display data from a database view (then disable all operations with unset_operations)?

When I try it I get an error about primary keys. Am I missing something?

sam
  • profile picture
  • Member

Posted 21 December 2012 - 14:54 PM

I am no expert, but it appears that a view does not have a primary key, so you will need to set it with something like the following line:

$crud->set_primary_key('id');