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 < t...@templestreetmedia.com> 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 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 -~----------~----~----~----~------~----~------~--~---