saveall with hasOne保存空白外键

时间:2009-09-03 08:59:39

标签: cakephp

我有以下模特关系:

询问:

var $hasOne = array(
    'SeminarAttendence' => array(
      'className' => 'SeminarAttendence'
  )  
);

SeminarAttendence:

var $belongsTo = array(
    'Enquiry' => array(
      'className' => 'Enquiry',
   'foreign_key' => 'enquiry_id',
  )
);

我的帖子数据如下所示:

[Enquiry] => Array
    (
        [first_name] => joe
        [last_name] => soap
        [email_address] => 
        [tel_home] => 
        [tel_work] => 
        [tel_cell] => 
    )

[SeminarAttendence] => Array
    (
        [branch_id] => 178 // this has no table relation it's for a web service
    )

我在控制器中保存所有这些:

$this->Enquiry->saveAll($this->data, array('validate' => 'first', 'atomic' => false

当我完成后,我在SeminarAttendence

中得到这样的结果
id  branch_id  enquiry_id
1   4               0
2   4               0
3   3               0
4   1               0

昨天在php5上工作正常,现在当我将它移植到我们的开发服务器(php4)时它不起作用?

1 个答案:

答案 0 :(得分:0)

这不是蛋糕问题。因为cakephp是为php4制作的,并且在php5上运行正常。可能是datebase或config

有问题