2011-03-14 8 views
0

私のモデルでは、難易度というフィールドがありますが、どのような値を指定しても、値1がデータベースに保存されます。Cakephpはフィールドを保存するように指定していますか?

私は、これは私が見たものである私は(保存)していた前モデルにdatadumpをした:

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私のdatadumpで、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 
} 
+2

dbの難易度フィールドのデータ型は? – deceze

+1

うわー、それはダムだった、それはTINYINT(1)>< –

答えて

0

を発生しても、私が誤ってTINYINTとして難易度のタイプを設定ネヴァーマインドは、(1)それを固定TINYINT(3)、うまくを行うことを意味しました。非常に愚かな間違い。

関連する問題