我有一个控制器动作,它应该在用户注册之前收集一些初步信息(注意,我还没有连接身份验证,没有人在安全问题上出错!)然后重定向到适当的控制器动作,但我无法弄清楚如何传递整个数据数组。可能是我太累了,我会在这里醒来,但如果有人能让我直截了当,我会很感激的。
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