我有一个控制器动作,应该在用户注册之前收集一些初步信息(抬头,我还没有连接auth,没有一个安全漏洞!)然后重定向到适当的控制器动作,但我无法弄清楚如何传递整个数据数组。我可能太累了,我会在这里醒来,但是如果有人能让我直截了当,我会很感激。
public function register() {
if ($this->request->is('post')) {
if ($this->request->url == "users/register") {
$data = $this->request->data('Registration');
switch($data['UserType']) {
case "student_reg":
/* I've tried this, and it feels right.. do have I to stop autorender or something? */
$this->studentReg($data);
break;
case "educator_reg":
/* and this: */
$this->redirect(array("action" => "educatorReg", "params" => $data));
break;
/* ... and so on.... */
}
}
}
$this->loadModel("Account");
$accounts = $this->Account->find( 'all');
$provinces = Hash::combine($accounts, '{n}.Account.province_id', '{n}.Province.name');
$this->set(compact('accounts','provinces'));
}
public function studentReg($data) {// and so forth
答案 0 :(得分:1)
如果你只是return $this->studentReg($data);
,你应该没事。如果已经渲染了Cake,则Cake不应渲染另一个视图。