you also have to specify a namespace like this
$this->getUser()->setAttribute('quantity', '10', 'shopping_cart');
$this->getUser()->getAttribute('quantity', 'a default value if quantity does
not exist', 'shopping_cart');
$sf_user->getAttribute('quantity', '', 'shopping_cart');
and if u want to remove the session use
$this->getUser()->getAttributeHolder()->removeNameSpace('shopping_cart');
On Wed, Sep 9, 2009 at 6:37 PM, guru <[email protected]> wrote:
>
> I'm new to Symfony and have problems with Accessing the User Session.
>
> In my /apps/frontend/modules/myapp/actions/actions.class.php Actions
> Class, I have something like this:
>
>
> public function executeAdd($request)
> {
> ...
> $this->getUser()->setAttribute('shopping_cart', 'test');
>
> }
>
> Letter, in my template file (apps/frontend/modules/myapp/templates/
> indexSuccess.php) when I try to get a value of "shopping_cart" with
>
> $sf_user->getAttribute('shopping_cart');
>
> so, 'shopping_cart' is empty.
>
> When I try to print out with $_SESSION, "shopping_cart" has a value.
>
> What am I doing wrong?
>
> Many thanks in advance for your help.
>
> Gezim
>
> >
>
--
kind regards
Farrukh K. Muhammad
skype id - mobileweaver
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---