Friday, February 27, 2009

Re: Sorting on additional fields

On Feb 27, 3:37 pm, georg <georgreitschm...@googlemail.com> wrote:
> i wouldn't caluculate the average each time.
> add a rating field to your products tabele and add an afterSave method
> to your ProductReview Model which calulates the new average and
> changes it in the Products Table each time a review is added.
> This should be much faster and easyer to handle.

In my opinion storing calculated data is a bad design decision.
Besides that, the products table should only contain information about
a product and nothing more (average product review ratings should not
be stored in the products table). This is especially important for
model reusability.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: