Re: calculated fields -- best way?

2006-09-29 Thread Scott Sharkey
AD7six wrote: > Hi Scott, > > I think the easiest way to deal with that is define in your model the > method afterFind. use a loop to go through the results and define what > you need. There is no need to worry about removing the data before > saving - if there is no corresponding field the data

Re: calculated fields -- best way?

2006-09-27 Thread [EMAIL PROTECTED]
Go for the afterFind callback. That way you don't have to call anything special other than your normal $this->Model->find() etc. The ONLY down side to using the afterFind is that is done everytime. Whereas Sonic's solution is valuable when you only need those enhanced "calculated" fields for cer

Re: calculated fields -- best way?

2006-09-27 Thread AD7six
Hi Scott, I think the easiest way to deal with that is define in your model the method afterFind. use a loop to go through the results and define what you need. There is no need to worry about removing the data before saving - if there is no corresponding field the data doesn't get included in th

Re: calculated fields -- best way?

2006-09-27 Thread Sonic Baker
Personally, I go for doing all that stuff in custom model functions, returning the results. See Chris' post, More Fuel for the "What Is A Model" Debate. Cheers, Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

calculated fields -- best way?

2006-09-27 Thread Scott Sharkey
Hi All, I have some fields that I need to present in the data views, which are calculated from the other fields in a model (goals against average, total points, etc). I was thinking the best way to do this is to modify the results array from the model, calculating the fields before presentat