Newscoop\GimmeBundle\Controller\CommentsController::getCommentsAction PHP Метод

getCommentsAction() публичный Метод

Get all comments
public getCommentsAction ( ) : array
Результат array
    public function getCommentsAction()
    {
        $em = $this->container->get('em');
        $showHidden = false;
        try {
            $user = $this->container->get('user')->getCurrentUser();
            if ($user && $user->isAdmin()) {
                $showHidden = true;
            }
        } catch (AuthenticationException $e) {
        }
        $comments = $em->getRepository('Newscoop\\Entity\\Comment')->getComments(false, $showHidden);
        $paginator = $this->get('newscoop.paginator.paginator_service');
        $comments = $paginator->paginate($comments, array('distinct' => false));
        return $comments;
    }