public function resetStats(array $entities)
    {
        foreach ($entities as $entity) {
            $entity->set('numOfComments', $entity->comments->getTotal());
            $last_comment = $entity->comments
                                   ->reset()
                                   ->order('creationTime', 'DESC')
                                   ->fetch();
            $entity->set('lastComment', $last_comment);

            if ($last_comment) {
                $entity->set('lastCommenter', $last_comment->author);
                $entity->set('lastCommentTime', $last_comment->creationTime);
            } else {
                $entity->set('lastCommenter', null);
                $entity->set('lastCommentTime', null);
            }
        }
    }
public function resetStats(array $entities)
    {
        foreach ($entities as $entity) {
            $entity->set('numOfComments', $entity->comments->getTotal());
            $last_comment = $entity->comments
                                   ->reset()
                                   ->order('creationTime', 'DESC')
                                   ->fetch();
            $entity->set('lastComment', $last_comment);

            if ($last_comment) {
                $entity->set('lastCommenter', $last_comment->author);
                $entity->set('lastCommentTime', $last_comment->creationTime);
            } else {
                $entity->set('lastCommenter', null);
                $entity->set('lastCommentTime', null);
            }
        }
    }
public function resetStats ( array $ entities ) { foreach ( $ entities as $ entity ) { $ entity -> set ( 'numOfComments' , $ entity -> comments -> getTotal ( ) ) ; $ last_comment = $ entity -> comments -> reset ( ) -> order ( 'creationTime' , 'DESC' ) -> fetch ( ) ; $ entity -> set ( 'lastComment' , $ last_comment ) ; if ( $ last_comment ) { $ entity -> set ( 'lastCommenter' , $ last_comment -> author ) ; $ entity -> set ( 'lastCommentTime' , $ last_comment -> creationTime ) ; } else { $ entity -> set ( 'lastCommenter' , null ) ; $ entity -> set ( 'lastCommentTime' , null ) ; } } }
Reset comment stats.

@param array $entities Entities to reset the stats
Reset comment stats .