简体   繁体   中英

CodeIgniter DataMapper Error: You must use the “set” method to update an entry

I'm using codeigniter/datamapper to develop an inviocing application and I'm getting an error that i don't understand. If I do the following:

$i = new Invoice();    
$i->save();

Then i get the following error: A Database Error Occurred

You must use the "set" method to update an entry.

Filename: /Users/jim/Sites/example.com/libraries/Datamapper.php

Line Number: 1635

However I can run this all day without any problem:

$i = new Invoice();    
$i->notes ='x';
$i->save();

Just wondered why it behaves like this? Any help/comments much appreciated. Thanks

For the datamapper you must assign the value to the object. If the object is empty then it is not going to save. So firstly set the value for the datamapper object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM