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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -