⚠ 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

Can CRUD operated on SQL Views !? Why did it fail ...



ci-expert

ci-expert
  • profile picture
  • Member

Posted 28 April 2012 - 23:06 PM

Hi,

I have created a View and was trying to use GCRUD to view it only using $crud->unset_operations();

$crud->set_table('view_table');
$crud->set_subject('VIEW TEST');

$crud->columns( 'tik_reference', 'tik_status',
'wedding_plan_date', 'wedding_plan_hour'
);

// Enable As Ready only

$crud->unset_operations();
$output = $crud->render();
$this->show_table_view($output);
}

I keep getting the following error though in an checkup all fields are OK in this test view (I've made it to show ONLY 2 rows)!
Any clue ??

[b]Fatal error: Cannot access empty property in /var/www/html/TNDEV/application/libraries/grocery_crud.php on line 1298[/b]

web-johnny

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

Posted 30 April 2012 - 17:54 PM

I will check to see if there is a quick fix for that. Though grocery CRUD isn't tested and not support yet SQL views.

belllee

belllee
  • profile picture
  • Member

Posted 01 March 2013 - 06:26 AM

Hi, can support VIEW now?

There are some error in $data->primary_key, when i use VIEW.Because there is no primary_key in VIEW.

So i judge the state of $data->primary_key,if it is false,don't use it.

 

I will check to see if there is a quick fix for that. Though grocery CRUD isn't tested and not support yet SQL views.


belllee

belllee
  • profile picture
  • Member

Posted 04 March 2013 - 09:14 AM

I have found another way to use VIEW.

You can set primary_key by set_primary_key

 this->grocery_crud->set_primary_key('taskDate');

 

and this key must be unique.