Cakephp是否指定要保存的字段?

Cakephp是否指定要保存的字段?,php,mysql,sql,cakephp,insert,Php,Mysql,Sql,Cakephp,Insert,在我的模型中,我有一个名为“难度”的字段,但不管我给它什么值,值1都会保存到数据库中 在保存之前,我对模型进行了数据转储,我看到: Array ( [title] => testtt34 [serves] => 32 [prep_time] => 32 [cooking_time] => 32 [difficulty] => 4 ) 但生成的sql查询cakephp如下所示: INSERT INTO `recipes` (`

在我的模型中,我有一个名为“难度”的字段,但不管我给它什么值,值1都会保存到数据库中

在保存之前,我对模型进行了数据转储,我看到:

Array
(
    [title] => testtt34
    [serves] => 32
    [prep_time] => 32
    [cooking_time] => 32
    [difficulty] => 4
)
但生成的sql查询cakephp如下所示:

INSERT INTO `recipes` (`title`, `serves`, `prep_time`, `cooking_time`, `difficulty`, `modified`, `created`) VALUES ('testtt34', 32, 32, 32, 1, '2011-03-13 19:15:16', '2011-03-13 19:15:16')
怎么回事?尽管在我的数据转储中难度显然是4,但sql生成的插入难度=1

//Do some checking to make sure the data is from proper location
$this->data = Sanitize::clean($this->data);
$this->Recipe->data = $this->data;
//error checking
$this->pa($this->Recipe->data['Recipe']);
if ($this->Recipe->save())
{
    //Blah do some stuff
}

不管怎样,我无意中设置了难度的类型,因为TINYINT1的意思是做TINYINT3,这就解决了它。非常愚蠢的错误。

数据库中难度字段的数据类型是什么?哇,太愚蠢了,设置为TINYINT1>