我在 CakePHP 2.3.0-RC1 中使用 ACL
当我更新用户字段(选择营销)时,我收到一个错误:
AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => User[Aro0.foreign_key] => 4 ) "
我认为这与拯救用户有关。我在手册中找不到有关如何解决此问题的任何内容。
这是从控制器中截取的方法:
$me = $this->Session->read('Auth.User');
// don't use the session to display, because they might have subscribed/unsubscribed
$user = $this->User->find('first',array('conditions'=>array('User.id'=>$me['id'])));
$optin = ! $user['User']['optin'];
$data = array(
'User' => array(
'id' => $me['id'],
'optin' => $optin
)
);
if ( $this->User->save($data) )
{
$this->Session->setFlash(__('Subscription status has been amended'));
}
else
{
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
$this->redirect(array('action'=>'account'));
重定向后,我收到 ARO 错误。