thanks for a hint! It will surely be useful in the future.
Faifas
On Sun, Aug 30, 2009 at 04:57, Miles J <mileswjohnson@gmail.com> wrote:
Well ok then:
User hasMany Post
User hasMany Comment
Within the users table you would have a column called post_count and
comment_count.
Within the Post and Comment model you would have.
var $belongsTo = array('User' => array('counterCache' => true));
And thats it.
On Aug 29, 3:45 pm, Aivaras <faifas1...@gmail.com> wrote:
> Sorry to say Miles, but the guy was asking for a double counterCache :x
>
> So, if User hasMany Post
> and User hasMany Recipe
>
> the guy would want user_post_count and user_recipe count in his users table.
>
> Unfortunately, I do not know the solution with cake's countercache :(
>
> Faifas
>
> On Sun, Aug 30, 2009 at 01:39, Miles J <mileswjohn...@gmail.com> wrote:
>
> > All you do is set it to true in your model associations, and whenever
> > an insert/delete happens the number changes. The manual describes it
> > pretty easily.
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment