I"m having trouble trying to retrieve the reply count to each thread in my message board software ( http://www.timorperfectus.com/users/devin/). I've tried a few things, but this is the current code I'm trying to get to work:
my $comments = $schema->resultset('News')->search(
{
replyid => 0
},
{
rows => 3,
page => scalar $q->param('page') || 1,
order_by => 'date DESC'
}
);
## let's get the comments
for ( $comments->all ) {
my $count = $schema->resultset('News')->search(
{
replyid => $_->postid
},
{
select => [
{
count => '*'
}
],
as => [ 'count' ]
}
);
my $c = $count->next;
my %row_data;
$row_data{'post_subject'} = $_->subject;
$row_data{'post_author'} = $_->author;
$row_data{'post_date'} = $_->date;
$row_data{'post_id'} = $_->postid;
$row_data{'post_content'} = $_->story;
$row_data{'replies'} = $c->count;
#$row_data{'is_hidden'} = $_->is_hidden;
# push it into the the loop....
push ( @end_posts, \%row_data );
}
If this is too much code to look at let me know and I'll trim it down...anyone have any ideas? Do you need to see my schema?
Thanks!
-devin
--
timorperfectus.com - web design to frightening perfection.
One last song
Given to an Angel's Son
As soon as you were gone
As soon as you were gone
_______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
