こうやったら出来た
[php]
private function add() {
if ($this->request->is(‘post’)) {
$this->User->create();
$this->log($this->request->data, ‘debug’);
$data = array(
‘Book’ => array(
array(‘name’ => ‘My first article’),
),
‘Tag’ => array(
array(‘flag’ => ‘Comment 1’),
array(‘flag’ => ‘Comment 2’),
array(‘flag’ => ‘Comment 3’),
),
);
$result = $this->User->saveAssociated($data,array(‘deep’ => true));
$this->log($result, ‘debug’);
if ($result) {
$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.’));
}
}
}
[/php]
参考サイト
https://github.com/markstory/cakephp-docs/blob/master/ja/models/saving-your-data.rst