where do "actions" go? |
I'm still quite new to programming but have been using PHP\CodeIgniter for a year or two.
I've been keeping my controllers really clean recently by putting all my data retrieve options in models, just loading and retrieving data in my controllers via the models and then passing this to views. Now I also have script for example that pings some IP's and reports on the status, at the moment I have this "action" in a model, feeding the result back into a DB, then another model/method that pulls the results to parts of the application that need that information. I thought this was the cleanest way. Yesterday I came across an article/discussion where people pointed out some code as "wrong" as the user was performing "actions" in a model rather than just retrieving data, which apparently is all models should do. So my question is, to keep my code clean but adhering to best practice, where is the best location to keep my actions? Some actions can be 50-100 lines easy, so I don't want them clogging up my controllers. I know there isn't a perfect answer as everyone does things different, I was just wondering how many years experience you have and what it is that you do? Thanks R |
Messages In This Thread |
where do "actions" go? - by rickoneeleven - 09-16-2015, 03:07 AM
RE: where do "actions" go? - by PaulD - 09-16-2015, 06:07 AM
RE: where do "actions" go? - by mwhitney - 09-16-2015, 07:49 AM
RE: where do "actions" go? - by rickoneeleven - 09-16-2015, 12:47 PM
RE: where do "actions" go? - by cartalot - 09-16-2015, 02:40 PM
RE: where do "actions" go? - by rickoneeleven - 09-23-2015, 04:41 AM
RE: where do "actions" go? - by ravinesh - 09-23-2015, 04:47 AM
RE: where do "actions" go? - by ComputingFroggy - 10-25-2015, 01:28 AM
RE: where do "actions" go? - by jaynarayan - 12-17-2015, 11:42 AM
|