Oh..! Thank you all for the solutions. Ya. My team-leader did the same in his case but I thought as my Forms should not know who the current user is and there might be a better way to do it in a better way...!
No probs.. will go with your solution now :-) ~Cheerz~ On Jan 19, 8:13 am, ken <marfillas...@gmail.com> wrote: > You can pass the sfUser instance as an option of the form or sub class > the form so you can switch form class in the controller based on user > credentials. > > On Jan 19, 1:29 am, Darren884 <darren...@gmail.com> wrote: > > > I had this problem before, you will have to take the user object and > > pass it to the form class and check the credentials and then unset the > > widget there. If there is no user object you will have to unset it. > > > On Jan 18, 9:25 am, Ahsanul <ahsanu...@gmail.com> wrote: > > > > Hello all, > > > > I have a Doctrine table called "Comment" which has a field called > > > "is_published" and as I have different type of users I don want my > > > basic users see my "is_published" widget. But I can not unset this > > > widget from a controller where I can check the credentials, on the > > > other hand in a form, I do not have access to the currently logged in > > > user so I can not check the credentials. I am sure Symfony has a > > > solution for this! Please help! > > > > My comment form is as following: > > > > Comment: > > > actAs: > > > Timestampable: ~ > > > columns: > > > id: { type: integer, primary: true, autoincrement: true } > > > title: { type: string(255), notnull: true } > > > body: { type: string(1024), notnull: true } > > > is_published: { type: boolean, default: false } > >
-- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@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.