Welcome Guest, Not a member yet? Register   Sign In
Model and Form
#5

(This post was last modified: 11-20-2014, 04:16 PM by slax0r.)

I tend to keep all of data operations in the models. Read the input with the controller, and pass it into the model. Then let model do with the data what it needs to do. This also includes preparing an array for database insert.
I like to keep controllers thin, and models fat.
I tried a different approach before, where I would prepare data to some degree in the controller, as you do in your second example.
After a while, the controllers grew out of hand. They became this unreadable piece of code.
But if I did most of this stuff in the models, I could group methods easier and keep it across more models logically.

Thank god that project got dumped, and fingers crossed it doesn't get picked up again.
Reply


Messages In This Thread
Model and Form - by aurelien - 11-20-2014, 03:24 AM
RE: Model and Form - by Rufnex - 11-20-2014, 04:10 AM
RE: Model and Form - by ivantcholakov - 11-20-2014, 05:00 AM
RE: Model and Form - by bclinton - 11-20-2014, 07:59 AM
RE: Model and Form - by slax0r - 11-20-2014, 04:11 PM
RE: Model and Form - by RobertSF - 11-20-2014, 05:59 PM
RE: Model and Form - by bclinton - 11-20-2014, 07:26 PM
RE: Model and Form - by slax0r - 11-21-2014, 01:43 AM
RE: Model and Form - by bclinton - 12-12-2014, 04:58 PM
RE: Model and Form - by mwhitney - 12-12-2014, 03:21 PM
RE: Model and Form - by bclinton - 12-12-2014, 04:55 PM
RE: Model and Form - by mwhitney - 12-15-2014, 10:02 AM
RE: Model and Form - by jaynarayan - 12-18-2015, 10:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB