If I change the first if statement to the following it works fine:

if (!session_id())
{
   return parent::save();
}

Am I going to cause any problems with symfony doing it like this?

Nicolas Perriault wrote:
> 2008/5/20 Tom Haskins-Vaughan <[EMAIL PROTECTED]>:
> 
>> Everything works fine, except when I run the propel-load-data task,
>> because of course there is no session.
> 
> I may be missing the point but here's what I'd do:
> 
>   public function save($con = null)
>   {
>     if (!$user = sfContext::getInstance()->getUser())
>     {
>       return parent::save();
>     }
> 
>     if ($this->isNew())
>     {
>       $this->setCreatedBy($user->getUserId());
>     }
> 
>     if ($this->isModified())
>     {
>       $this->setUpdatedBy($user->getUserId());
>     }
> 
>     parent::save();
>   }
> 
> ++
> 

-- 
Tom Haskins-Vaughan
Temple Street Media: Design and Development for the Web
[EMAIL PROTECTED] | www.templestreetmedia.com

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to