0
我有關係:帖子的hasMany SomeModelCakePHP中添加具有的hasMany關係數據不形
郵政有字段:ID,標題,文字
SomeModel具有字段:ID,UNIQUE_NAME
我創造形式:
echo $form->create('Post');
echo $form->input('title');
echo $form->input('text');
echo $form->end();
如何保存這樣的數據關係:
$data['Post']['title'] = 'Lorem' // from form
$data['Post']['text'] = 'Ipsum' // from form
$data['SomeModel']['unique_name'] = 'generating_unique_name_in_SomeModel'`
我嘗試在SomeStool的beforeSave中添加$this->data['SomeModel']['unique_name']
,但在PostController的saveAll中不起作用。
Ooo ...謝謝這是我的疏忽 – kicaj