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.

比如在用rest工具测试的时候,post请求体没有内容,或者没有设置,会导致提示这个信息

CodeIgniter报错: You must use the "set" method to update an entry的更多相关文章

  1. java8 list转Map报错Collectors.toMap :: results in "Non-static method cannot be refernced from static context"

    1.问题:java8 list转Map 报错Collectors.toMap :: results in "Non-static method cannot be refernced fro ...

  2. 用apache-cxf生成webservice客户端的时候报错Parameter: shead already exists for method

    版本apache-cxf-3.1.0 命令如下:wsdl2java -p com.wz.interfaces -d ./src -client ./ws/xxx.wsdl 报错如下: WSDLToJa ...

  3. ExtJs 4.2.1 报错:Uncaught TypeError: Cannot call method 'getItems' of null

    做项目的时候遇到这个问题,搞了一上午终于解决了,让我们看看是什么问题: buttons: [ { text: '保存', icon: '../../../Images/extjs/disk.png', ...

  4. React报错:Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix,

    今天在开发时报了以下错误,记录一下 我们不能在组件销毁后设置state,防止出现内存泄漏的情况 出现原因直接告诉你了,组件都被销毁了,还设置个锤子的state啊 解决方案: 利用生命周期钩子函数:co ...

  5. Feign调用远程服务报错:Caused by: java.lang.IllegalStateException: Method getMemberInfo not annotated with HTTP method type (ex. GET, POST)

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ord ...

  6. Mysql报错Error Code: 1175. You are using safe update

    使用MySQL执行update的时候报错:Error Code: 1175. You are using safe update mode and you tried to update a tabl ...

  7. 【pheatmap热图scale报错】Error in hclust(d, method = method):NA/NaN/Inf in foreign function call (arg 11)

    初始数据类似如下: 填充下缺失值 data[data==0] <- NA data[is.na(data)] <- min(data,na.rm = T)*0.01 pheatmap(lo ...

  8. Java报错:Unable to find setter method for attribute: [x]

    在学习JavaWeb JSTL与自定义标签时遇到的坑,用的老师给的代码结果直接原地报错:javax.servlet.ServletException: org.apache.jasper.Jasper ...

  9. mysql uodate 报错 You can't specify target table '**' for update in FROM clause

    You can't specify target table 'sc' for update in FROM clause 背景:把“sc”表中“叶平”老师教的课的成绩都更改为此课程的平均成绩: 上面 ...

随机推荐

  1. 在Main中定义student的结构体,进行年龄从大到小依次排序录入学生信息。(结构体的用法以及冒泡排序)

    using System; using System.Collections; using System.Collections.Generic; using System.Linq; using S ...

  2. How to Write and Publish a Scientific Paper: 7th Edition(科技论文写作与发表教程)(11.04更新)

    How to Write and Publish a Scientific Paper: 7th Edition(科技论文写作与发表教程)(11.04更新) 重要通知: 最近开题报告已差不多告一段落, ...

  3. C++标准转换运算符reinterpret_cast

    C++标准转换运算符reinterpret_cast reinterpret_cast <new_type> (expression) reinterpret_cast运算符是用来处理无关 ...

  4. Linux下搭建svn服务器(转)

    原文地址:http://blog.163.com/longsu2010@yeah/blog/static/173612348201202114212933/ 安装步骤如下: 1.yum install ...

  5. Ubuntu格式化分区时的一个小错误

    admin@gpc:/$ sudo  mkfs -t ext3 -c /dev/sdb1 mkfs.ext3: inode_size (128) * inodes_count (0) too big ...

  6. Spark-1.0.0 standalone分布式安装教程

    Spark目前支持多种分布式部署方式:一.Standalone Deploy Mode:二Amazon EC2.:三.Apache Mesos:四.Hadoop YARN.第一种方式是单独部署,不需要 ...

  7. Matlab数值计算最简单的一个例子——指数衰减

    放射性衰变是指数衰减的典型例子.另外还有化学反应某反应物的减少,RC电路电流的减小,大气压随海拔高度的减小等. 指数衰减的方程: \begin{equation} \frac{dN(t)}{dt}=- ...

  8. POJ 2418 Hardwood Species

                                                     Hardwood Species Time Limit: 10000MS   Memory Limit ...

  9. 整理的dedecms标签大全,方便查找

    平时用dedecms开发经常会用到一些标签,特别是首页.栏目页.内容页,这些页面都会用到标签的调用,比如title.keywords.description.arclist.field.body等,为 ...

  10. 2d背景循环

    using UnityEngine; using System.Collections; /// <summary> /// 2d背景循环滚动 /// </summary> p ...