• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
You must use the "set" method to update an entry.

#1
I am here again.
I want to use the save method of the model class


the code In my controller:

PHP Code:
$data $this->request->getPost();
$model = new \App\Models\MyModel();
$model->save($data); 


My Model:
Code:
protected $table      = 'user';
protected $primaryKey      = 'id_user';
protected $returnType = '\App\Entities\E_User';



the problem is the server returns
"You must use the "set" method to update an entry."
In the user guide the set method is used in database Builder class but not say nothing about the relationship between set and save methods.

so How can I use the save method.?
Reply

#2
It sounds like you haven't filled out the $allowedFields array with the columns that should be editable.
Practical CodeIgniter 3  • CodeIgniter 4 Foundations - Coming Soon • Vulcan - CLI Tools for CI4
Reply

#3
thanks again. you're right. I thought that allowed_fields was optional.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.