我使用 Symfony 1.4、Doctrine 1.2 和 sfDoctrineGuardPlugin。在 actions.class.php 我有:
$this->idsfguard = $this->getUser()->getGuardUser()->getId();
如果我登录这项工作很好,但如果我注销然后我有错误:
致命错误:在非对象上调用成员函数 getId()
我试过:
if ($this->getUser()->getGuardUser()->isAuthenticated()){
$this->idsfguard = $this->getUser()->getGuardUser()->getId();
}
但我有错误:
致命错误:在非对象上调用成员函数 isAuthenticated()