ユーザーとプロファイルの 2 つのモデルを使用してアプリケーションを開発しています。一度に両方のモデルを編集しようとすると、このエラー
Array to string conversion [CORE\Cake\Model\Datasource\DboSource.php, line 1006]
my $this->request->data
array is inが連続して発生します
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')
助けてください...よろしくお願いします