thanks.
because I'm new in symfony I don't understand your mean completely.
Can you describe where to do that?

On Mon, Dec 13, 2010 at 2:21 AM, khalid <abdel.kha...@gmail.com> wrote:

> yes never use the context in your model.
>
> if you have on your action
> $object = $this->from->getObject()->setUserId($this->getUser()->getId());
> $this->from->save();
>  the solution of gabriel is nice you can use the option of your form for
> inject the user_id or guard user object.
>
> good luck
> 2010/12/12 Gabriel Petchesi <pghora...@gmail.com>
>
> Although this solves the problem it is not the recommended way of doing
>> things.
>> Think about loading/importing data via fixtures, from the CLI, where you
>> have no session thus an invalid user_id will be inserted.
>> Also you may not want to automatically update this field when an object is
>> saved due to various reasons.
>>
>> The proper way to do this is via forms, inject the user_id in the action
>> as parameter when bind-ing and processing the form.
>>
>>     gabriel
>>
>>  --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.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
>> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>>
>
>  --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.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
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to