Elo*_*fin 0 symfony1 sfdoctrineguard
我已经启用了sfDoctrineGuardPlugin,所以我将myUser类更改为我的类扩展sfGuardSecurityUser.
我已经覆盖了sfGuardUser架构以添加我自己的关系
Personnage:
local: id
foreign: user_id
type: one
onUpdate: CASCADE
onDelete: CASCADE
Run Code Online (Sandbox Code Playgroud)
生成模型时,如果继续使用BasesfGuardUser.class.php,我可以在PHPDoc注释中看到我的关系已创建,并且已添加属性Personnage.
* @property Personnage $Personnage
Run Code Online (Sandbox Code Playgroud)
但我不明白,当我尝试访问此属性时,我不能.
在控制器中:
$user = $this->getUser();
$user->Personnage;
Run Code Online (Sandbox Code Playgroud)
在视图中:
echo $sf_user->Personnage
Run Code Online (Sandbox Code Playgroud)
而错误:
Notice: Undefined property: myUser::$Personnage
Run Code Online (Sandbox Code Playgroud)
我怎样才能访问这个属性?
| 归档时间: |
|
| 查看次数: |
1207 次 |
| 最近记录: |