tags:

views:

70

answers:

1

What do you have in your model classes. Generally if i use any framework or any library (Zend Framework) , my classes only have variable which is table name . I know that in complicated applications models have lots of thing to do , so i want to know what these jobs are.

Maybe instead of using library`s general select function ,you create special functions to get data from database ( getUserById() ) . To sum up , which parts of the process should go in to model layer.

For example thing about general user processes .So in registration process where should we check email is acceptable or not . This is example just explain what do you do in your model layer.

This question may seem as an abstract question because of my english , but it is not . If you can edit it please improve it . The purpose of this question is better understanding of mvc pattern

+1  A: 

Well, in general, models should do the main work regarding your business layer. So, if you have a pretty complex query using (and combining) the accessor functions of the database layer (thus, your model), you should instead write an extra function for that query in your model class. Makes it much easier to change the implementation of your model (e.g. database-table-wise).

EDIT: To answer your other question: validating an e-mail should happen in the controller, usually using some kind of component, utility class or library...

Franz
To sum it up: your controller knows what it wants to do, but it should not care (and not know) how to do it.
Franz