1
votes

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. ;)

Edit after answers:

get:

$this->getUser()->getAttributeHolder()->set('beilagenbuchung.page', 1, 'admin_module');

set:

$this->getUser()->getAttributeHolder()->get('beilagenbuchung.page', null, 'admin_module');

Regards

Nils

2

2 Answers

1
votes

Check the doc ?

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).

See also, the sfUser.class.php where the getter are to retrieve attributes.

0
votes

Out of any context (meaning sfAction, sfComponent...) you can always set attributes like this:

sfContext::getInstance()->getUser()->setAttribute('key', 'value');