CakePHP错误:调用成员函数getColumnType() [英] CakePHP error: Call to a member function getColumnType()

查看:329
本文介绍了CakePHP错误:调用成员函数getColumnType()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编辑数据库中的记录,但脚本给我以下错误:

I'm trying to edit a record in the database, but the script gives me the following error:

致命错误:调用成员函数在G:\wamp\www\a11\a\cake\libs\model\model.php第980行上的非对象上的getColumnType()

奇怪的是,如果我从表单中删除id(所以它创建了一个新的记录),它不抱怨。这意味着id列有问题。

The strange thing is, if I remove id from the form (so it creates a new record) it doesn't complain. That means that there's something wrong with the id column.

但是什么?

要保存的数组:

Array
(
[Process] => Array
    (
        [id] => 5
        [oobject] => 1
        [oproperty] => Number
        [wproperty] => Payed
        [do] => somecode
        [active] => 1
        [name] => Testing
        [changed_user_id] => 3
        [selftrigger] => 1
    )

)

保存代码现在看起来像这样:

The saving code now looks like this:

$d = $this->data;
if ($this->Process->save($d)) {

id

id exists in the database

我感谢任何帮助!

推荐答案

id列标记为id(不带引号),是否正确?如果您使用MySQL,请确保ID类型是int(不是任何变体),并且它是自动增量的主键。这些设置是模型类正常运行所必需的。

The id column is labeled "id" (without quotes), correct? If you are using MySQL, make sure that ID type is int (not any variation) and that it is the primary key with auto-increment. These settings are needed for the model class to function properly.

从这个错误,它看起来像您已将id列设置为int以外的内容。

From this error, it looks like you have set the id column to something other than int.

这篇关于CakePHP错误:调用成员函数getColumnType()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆