Depending on how precise your information should be you can add a
number_of_posts field to your users table and update the count
periodically, you can also keep the field updated with database
triggers, or create an action to run the update query from cakephp
admin pages on demand.

That's just another way of dealing with it.

Regards


On 13 jun, 13:11, DigitalDude <e.blumsten...@googlemail.com> wrote:
> Hey,
>
> I have a problem here and need to fix it. It's about the following
> situation:
>
> I have a model "User" that has a relation to some entrie, let's say
> "Posts". I want to paginate the User-Model and add a counting of the
> user's posts to my index of Users. So I will have the following table-
> structure in my view:
>
> Id Name Posts Actions
> 2  Ben      5       view/edit/delete
> 5  Mary    8       view/edit/delete
>
> The first two columns are easy to sort, but HOW can I sort my
> paginated user-array by the count of the related Post-entries?
>
> I would really appreciate some help here, because I just cannot find a
> way to do this... :(
>
> Regards,
>
> DD

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to