MVC in php, model for categories? -


i building first little app php , trying mvc.

my website requires quite large arrays of cities , categories.

my question simple 1 arrays data website php arrays, should arrays placed own models?

from understood models used business logic , accessing data, cities , categories data justify them having model?

and if answer no why , should do?

thanks

model responsible retrieving, editing, deleting , manage data. data comes static sources such databases, xml files , such.

you should create model classes interface data. that's model supposed do. can hold data in private members way want, arrays, other classes etc.

you wondering why idea? well, data should stored in classes because can set visibility class members. data items private can decide actions allowed, leading general better design , security.

also models don't contain logic in them. it's controller deals logic. it's in mv (model / view) architecture models implements logic.

you can take @ how popular frameworks handle them.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -