[eluser]owidiuszek[/eluser]
Hello guys (and ladies??
)
When I look on my backend controllers almost every controller shares same idea.
We have some content item (user, post, category, player, team, event, image whatever).
And on each of this content items I'm making same routine like add/edit , delete, validate plus some specific ones.
I know that I can make my_model for most common stuff done on model side (I'm using doctrine on most of my projects so its a little different) but I'm not saying about model - I would like to talk about controller.
for each add I'm add/edit I'm making same things:
- checking post data (if is sent, from which form, some other checks like permissions)
- validating
- deciding whether add or update
- perform those actions
- make some specific stuff related to specific content type(like creating directory)
- notifying user
- redirecting back
and this pattern is common for most of my admin controllers.
And now I have question :
What kind of best practice would You suggest. Should I extract most common actions to my admin_controller or try to make controller as light as possible and throw everything to model? Please remember that I'm talking about post data checks, validation, directory creating etc not about exact CRUD, sql stuff