我正在使用 2 个模型、用户和配置文件开发应用程序。当我尝试一次编辑两个模型时,我不断收到此错误
Array to string conversion [CORE\Cake\Model\Datasource\DboSource.php, line 1006]
我的$this->request->data
数组在
array(
'User' => array(
'password' => '*****',
'id' => '6',
'first_name' => 'some',
'middle_name' => 'kjkj',
'last_name' => 'one',
'username' => 'kadjssa',
'group_id' => '5',
'mobile_no' => '7867868'
),
'Profile' => array(
'skype' => 'shrinet'
)
)
我的用户控制器编辑功能包含
public function editClient($id = null) {
$this->User->id = $id;
if (!$this->User->exists()) {
throw new NotFoundException(__('Invalid user'));
}
debug($this->request->data);
if ($this->request->is('post') || $this->request->is('put')) {
$this->request->data['User']['user_id'] = $this->Auth->User('id');
$this->request->data['Profile']['user_id'] = $id;
debug($this->request->data);
print_r (debug($this->User->invalidFields()));
if ($this->User->saveAll($this->request->data)) {
$this->Session->setFlash(__('The user has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
} else {
$this->request->data = $this->User->read(null, $id);
}
$groups = $this->User->Group->find('list');
$this->set(compact('groups'));
}
在调试它的给予
SQL Query: INSERT INTO `mvs`.`users` (`id`, `first_name`, `middle_name`, `last_name`, `username`, `password`, `group_id`, `mobile_no`, `user_id`, `modified`, `created`) VALUES (Array, Array, Array, Array, Array, Array, Array, Array, Array, '2013-07-05 00:07:13', '2013-07-05 00:07:13')
请帮助我...在此先感谢