Symfony 1.4:如何操作attributeHolder? [英] Symfony 1.4: How to manipulate the attributeHolder?
问题描述
我在 myUser attributeHoler 中有一个名为admin_module"的属性,我想操纵它……但我什至不知道如何访问存储在那里的值.我知道如何在操作中获取 AttributeHolder,但我不知道如何访问其中的值.任何帮助表示赞赏......提前致谢.;)
I have an Attribute called 'admin_module' in myUser attributeHoler and i want to manipulate it...but i don't even get how to access the values stored there. I know how to get AttributeHolder in an action, but I don't have a clue, how to access the values in it. Any help appreciated...thanks in advance. ;)
回答后
获取:
$this->getUser()->getAttributeHolder()->set('beilagenbuchung.page', 1, 'admin_module');
设置:
$this->getUser()->getAttributeHolder()->get('beilagenbuchung.page', null, 'admin_module');
问候
尼尔斯
推荐答案
检查 文档 ?
顺便说一下,您可以使用 Web 调试工具栏查看所有属性:config > User > attributeHolder.键是使用的命名空间(如果你定义了一个).
And by the way, you can see all the attribute using the web debug toolbar: config > User > attributeHolder. Key is the namespace used (if you define one).
另见 sfUser.class.php 获取器用于检索属性的位置.
See also, the sfUser.class.php where the getter are to retrieve attributes.
这篇关于Symfony 1.4:如何操作attributeHolder?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!