0

I'm working on a Symfony 2.8 based project, I installed Sonata Admin Bundle and User Bundle and all is working perfectly.

I have a customized register and profile pages, and the users are well managed by the admin dashboard and all is at top. But, a new feature just appeared. So the users were meant to be University Professors, so I added all the fields necessary for representing them. But now they want also students to be able to register in the application, and be managed by admin dashboard as well. Do you have any ideas what will be the best way to separate the students from the professors, they will both have a lot of fields in common. In fact, I just need a flag (student or not). But how will they appear in distinct lists in the admin dashboard ? I'm thinking about groups but I'm not sure how to affect a user to a group when registering.

Thank you

Auranx
  • 51
  • 1
  • 7

1 Answers1

0

If all you need is a flag, you can add it (lets just say you call it isProfessor), then add a datagrid filter on that flag.

This will allow you to filter on whether isProfessor is true or not.

https://sonata-project.org/bundles/admin/master/doc/reference/action_list.html#filters

If you want specific lists of professors/students you could create a custom list view for each:

https://sonata-project.org/bundles/admin/master/doc/cookbook/recipe_custom_action.html

Should be pretty straightforward.

Richard
  • 4,079
  • 1
  • 14
  • 17
  • Thanks @Richard , I want to go with the professors/students lists, each one in a separate list of its own. I read the second link and I think it will be helpful, althought it looks complicated. The remaining question is how will I be able to offer two registration forms, when all I have is the /register route ? – Auranx Mar 29 '16 at 09:43
  • That's a separate question and I think reasonably complex, there are a good few asking that on this site though so plenty to get you started :) – Richard Mar 29 '16 at 19:42