thanks, that what i was after.

On 4 May 2010 18:27, Casey <casey.cam...@gmail.com> wrote:

> Doctrine make this easier.  The way you are doing it works, but it may
> be harder to maintain in the future.  I would reccommend something
> like this:
>
> MemberForm.class.php::
> function configure(){
>   parent::configure();
>   $this->getObject()->user_id = sfContext::getInstance()->getUser()-
> >getGuardUser()->id;
> }
>
> When this form saves it will save the Member object with the current
> users user_id.  It is best to keep this kind of logic in the form,
> specifically the configure() method, it will be much easier in the
> future if you perform as little logic as possible in the action or the
> view.
>
> HTH,
> Casey
>
> On May 4, 4:27 am, Sela Yair <tzi...@gmail.com> wrote:
> > I think I found slick solution, would like to get some feedback if that's
> > the ideal solution.
> >
> > in action.class.php
> >
> > i modified the $form->bind
> >
> >  *protected function processForm(sfWebRequest $request, sfForm $form)*
> > *  {*
> > *    $formData = $request->getParameter($form->getName());*
> > *    $formData['user_id'] = $this->getUser()->getGuardUser()->getId();*
> > *    $form->bind($formData, $request->getFiles($form->getName()));*
> > *    if ($form->isValid())*
> > *    {*
> >
> > On 4 May 2010 10:50, Sela Yair <tzi...@gmail.com> wrote:
> >
> >
> >
> >
> >
> > > Thanks.
> > > Yes that's what I'm after.
> >
> > > the following is the table in schema.yml
> > > Member:
> > >   actAs:
> > >     Timestampable: ~
> > >   columns:
> > >     date_birth:
> > >       type: date
> > >       notnull: true
> > >     logo:
> > >       type: string(255)
> > >     is_public:
> > >       type: boolean
> > >       notnull:  true
> > >       default:  1
> > >     is_activated:
> > >       type: boolean
> > >       notnull:  true
> > >       default:  0
> > >     country_id:
> > >       type: string(2)
> > >     user_id:
> > >       type: integer(4)
> > >   relations:
> > >     sfGuardUser: { foreign: id, local: user_id, onDelete: cascade }
> >
> > > Someone can insert its details only if s/he's registered, and i want
> the
> > > user_id to be populated with the current user id. i managed to do it by
> > > updating a property in the lib/model and when using Save method
> changing
> > > this column, but i believe there's more elegant way to do it.
> >
> > > On 4 May 2010 10:09, Tom Ptacnik <to...@tomor.cz> wrote:
> >
> > >> Yes you can do a relation between a user and another table object. Is
> > >> that what you want?
> > >> Please describe you question again..
> >
> > >> On 3 kvÄ›, 14:37, Sela <tzi...@gmail.com> wrote:
> > >> > I want to associate a table with the user ID generated from
> > >> > sfDoctrineGuardPlugin when the user is logged in. I thought to do it
> > >> > in save() but not sure how to get the userID at that point as it's
> in
> > >> > lib/model/doctrine and in the plugin readme they explain how to get
> > >> > the value only from the template or the action.
> >
> > >> > --
> > >> > 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>
> <symfony-users%2bunsubscr...@goog legroups.com>
> > >> > For more options, visit this group athttp://
> > >> 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>
> <symfony-users%2bunsubscr...@goog legroups.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 athttp://
> 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