开发者

symfony - sfDoctrineGuardPlugin - creating custom users

I'm using sfDoctrineGuardPlugin and I'm coming across a small issue.

I have several 'user types', i.e. Admins, Managers, Account Holder.

What I need is to be able to create these users and have specific forms for each type when creating them.

What I'd really like to do, is possibly have a link to something like Create Admin, Create Manager and Create Account Holder, which would like to the form for the user I'm trying to create.

Would I need to create several actions in the开发者_开发问答 plugin to accomodate this, i.e. executeAdmin(), executeManagers and then call a custom form, which my specific widgets configured?

Thanks


If you want use admingen, I recommend you to create 3 modules based os sfguarduser model, one per user type.
Then, in each generator.yml you can specify in form block :

form:

class: adminForm (for exemple)


You could define those user types as subclasses of the sfGuardUser class. Then, you would have one form for each type, inheriting from sfGuardUserForm.

In your module, either you create an action for each type, if some controler and template code is very specific, or you create a single action, with a test on some parameter to use the correct form class.

Oh, and don't add any code to the plugin. This is a very bad practice. Instead, extends the plugin action in a custom module in your application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜