hi Walker,
imagine you have a regular forum.
you will end up having categories, forums (and subforums, joined with
themselves), topics and posts.
you call the forum index page, go to a forum and display the number of
topics/posts in there.
without something like counterCache what do you do? make a findCount on
the fly? fetch every association recursively and do a count() in php?
no, it's better that when writing a new post or remove one to have a
field post_counter in Forum model that have this number for you.
same thing goes with other, like Topic, which you have the number of
posts in there.

This is useful also for User and Articles, when user write a new
Article the field article_count in model User gets automatically
updated with the new count of its articles, so you can use this value
when you want without fetching associations to make the count.

The way this behavior works is not like in rails, when they use
increment/decrement field, it's far more accurate because it has three
callbacks, one for inserting and two for deleting, and the updating of
fields is made with findCount.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to