Oh yes, and sfUser->getAttribute() has a default option if there is no value to get. In other words:
echo sfUser->getAttribute('value_i_want', "default value"); If the session variable 'value_i_want' is set it returns that value else it will return "default value" On Fri, Sep 25, 2009 at 12:13 PM, DEEPAK BHATIA <toreachdee...@gmail.com>wrote: > "The session object for the current user is accessed in the action with the > getUser() method and is an instance of the sfUser class. This class > contains a parameter holder that allows you to store any user attribute in > it. This data will be available to other requests until the end of the user > session, as shown in Listing 6-15." > > ================================================ > > Hi, > > I have taken above from the Chapter 6 - Inside The Controller Layer. > > When a the user sessions ends, the session variables will have the values > returned as "NULL", I guess. > > So is it safe to redirect the action to error template in case session > variables returns NULL ? > > For example, in the line of code below, I assume that I get something from > 'allnames' session variable. However if it is "NULL", means the session is > broken now. > > $current_name = $this->getUser()->getAttribute('allnames'); > > Please suggest suitably. > > Thanks > > Deepak Bhatia > > > > > > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---