php - mvc design question -


i using zend framework , doctrine in app

in web application have various individual modules events, conferences, case studies.. making controller design @ moment. in below image regulatory document controller , sub actions. regulatory doc, videos, podcasts having same kind of functionality. design appropriate...? in mvc each action having separate view. , on user type may have put access levels on modules. have kept separate controller can control module each user type. resulting in duplicate code.

enter image description here

now thinking make 1 parent class , in have common methods. eg. have common class resources , in keep list, search, suggest, addfavorite etc. , parent above given controllers.

so how manage view these different modules if go approach..? if go code bit messy..?

if understand correctly have set of common behaviors among regulatory documents, videos , podcasts.

in case should try abstract commonalities out parent class these 3 areas inherit.

as example, have own mvc framework define superclass tnh_controller other controllers (eg: venue_controller, group_controller) inherit. in parent controller define header() , footer() , delete() methods. can use unchanged in child classes , save myself effort.

you can likewise of common work models (crud) in model superclass, overriding needed. of logic different models comes class variables (table names, column names, etc).

i wouldn't worry being "strict" mvc. instead try work out save time , keep code organized. sounds you're on right track putting similar behaviors @ parent level.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -