EllisLab text mark
Advanced Search
     
Where to put business/application logic?
Posted: 21 July 2007 05:23 PM   [ Ignore ]
Joined: 2007-07-18
92 posts

Sorry if this is a dumb question, but where is the best place to put business logic (not sure if thats the right term). For example I am using a model to run a select query, that just returns the results of that query to a controller. I need to take that results set and put half of it in one array, and half in another. Right now I use two private functions in the controller to do this, but I’m not sure if this is a “good way” of doing things.

 Signature 

Check it out: Critique Computer Products

 
Posted: 22 July 2007 03:28 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2006-02-06
117 posts

If you are always doing this, you could split the result in the model and return an array - 2 element array containing an array in each element.

Or create a resultDivide() method in the model and run the result through that.

If there is only one instance where this functionality is needed, then doing as you are is fine.

 Signature 

My Blog, I work at Erskine Design

 
Posted: 22 July 2007 03:58 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-07-18
92 posts

Ah, that makes sense. It’s a one time thing so I’ll just leave it in the controller. Thanks for the help!

 Signature 

Check it out: Critique Computer Products