Newscoop\Entity\Repository\CommentRepository::setCommentStatus PHP Method

setCommentStatus() private method

Method for setting status for a comment
private setCommentStatus ( Comment $p_comment, string $p_status ) : void
$p_comment Newscoop\Entity\Comment
$p_status string
return void
    private function setCommentStatus(Comment $p_comment, $p_status)
    {
        $em = $this->getEntityManager();
        if ($p_status == 'deleted') {
            $em->remove($p_comment);
        } else {
            $p_comment->setStatus($p_status);
            $em->persist($p_comment);
        }
        $em->flush();
        $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
        $cacheService->clearNamespace('comment');
        $user = $p_comment->getCommenter()->getUser();
        if ($user instanceof User) {
            $em->getRepository('Newscoop\\Entity\\User')->setUserPoints($user);
        }
    }