Containable afterfind solution, proper usage?


CakePHP 2.9.X

I have to run a series of calculations on a number of associated model data. This works great if I am accessing the main level model where I am running the calculations and updating appending the information in afterFind. Everything returns perfectly, but if I go three levels or more deep using contain I get nothing, afterFind is not executed and so the calculations are not working. i have read a lot of articles that explain why this is and I agree and understand, however I have not seen anything that is considered the “appropriate” way of handling this.

A helper class? But then you have to send the data to the helper when its already accessible within the model.

I don’t want to duplicate code and then have to update two places when changes are necessary.

I hope I did a decent job of explaining myself. Can anyone suggest a solution?