Thanks, Thomas.

Do you mean it's not good practice to use sfContext::hasInstance() or to 
use the $_SERVER array?

Tom

Thomas Rabaix wrote:
> you have to use 
> 
> if (sfContext::*has*Instance())
> {
>   $user = sfContext::getInstance()->getUser();
>   // no your stuff
> }
> 
> return parent::save($conn);
> 
> 
> THIS IS NOT A GOOD PRACTICE !!!
> 
> 
> On Thu, Jun 25, 2009 at 10:02 PM, Tom Haskins-Vaughan 
> <[email protected] <mailto:[email protected]>> wrote:
> 
> 
>     But this seems to work:
> 
>     if (!array_key_exists('REMOTE_ADDR', $_SERVER))
>     {
>       return parent::save($conn);
>     }
> 
>     $user = sfContext::getInstance()->getUser();
> 
>     ...
> 
>     Tom Haskins-Vaughan wrote:
>      > But $_SERVER exits even on the CLI :(
>      >
>      > Lee Bolding wrote:
>      >> On 25 Jun 2009, at 15:26, Tom Haskins-Vaughan wrote:
>      >>
>      >>> Just come across this problem. What's the best way to test if
>     the model
>      >>> class is being called by the cli or not?
>      >> Test for the presence of the $_SERVER array.
>      >>
>      >
>      > >
>      >
> 
> 
> 
> 
> 
> -- 
> Thomas Rabaix
> http://rabaix.net
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to