0
嗨我正在symfony中構建一個註冊系統。它有三種模式 - 用戶,求職者和僱主。求職者和僱主繼承用戶。 求職者註冊過程中有4個步驟,第一步用戶必須輸入他們的登錄詳細信息&它將被添加到用戶表中。在接下來的步驟中,用戶必須輸入他的個人信息,它將被添加到求職者表中。使用symfony + doctrine中的一種格式更新多項式
我想使用一種形式更新用戶表和求職者表,我該怎麼做? (例如地址和TP數是在user表中,但它會在第二階段進行更新)
三江源烏爾答覆
據工作
我做的是
在我的DAO類
public function updateStep($step,$address, $phone, $id)
{
Doctrine_Query::create()
->update('User u')
->set('u.step', '?', $step)
->set('u.address', '?', $address)
->set('u.telephone', '?', $phone)
->where('u.user_id = ?', $id)
->execute();
}
在窗體類
public function updateStep()
{
$step = $this->getValue('step');
$phone = $this->getValue('phone');
$address = $this ->getValue('address');
$id = $this->getValue('user_id');
$updateStep = $this->getUserManagementService()->updateStep($step, $address, $phone, $id);
return $updateStep;
}
最後的註冊操作
$this->form->updateStep();
這是工作,但我在做它在正確的道路或有任何更簡單的方法存在嗎?