Troy Schmidt wrote: > Okay they can be done with CakePHP. The first thing you need to do is > make the "virtual fields" of average_rating and CameraCount using > afterFind in your model.
I'm not saying that what Troy has written is wrong, per se (because it's not) but don't use afterFind for anything other than the most basic of data manipulation (and if it's something that can be preformed in the DB then don't do it at all). AVG and other such aggregate functions are best preformed by the database. Your database is many orders of magnitude faster when it comes to doing these sort of calculations and if you're doing anything with large sets of data trying to pass this sort of task to the application layer will absolutely kill you in terms of performance. Cheers, Matt -- BASIC: A programming language. Related to certain social diseases in that those who have it will not admit it in polite company. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---
