我引用了http://agiletoolkit.org/codepad/newsletter上的 2 步时事通讯示例。我将示例修改为 4 步过程。以下页面类是第 1 步,它用于插入新记录并获取新记录 ID。问题是我不想在最后一步之前将此记录插入数据库。我不确定如何在不使用 save() 函数的情况下检索此 ID。任何想法都会有所帮助。
class page_Ssp_Step1 extends Page {
function init(){
parent::init();
$p=$this;
$m=$p->add(Model_Publishers);
$form=$p->add('Form');
$form->setModel($m);
$form->addSubmit();
if($form->isSubmitted()){
$m->save();//inserts new record into db.
$new_id=$m->get('id');//gets id of new record
$this->api->memorize('new_id',$new_id);//carries id across pages
$this->js()->atk4_load($this->api->url('./Step2'))->execute();
}
}
}