Fixed non-public news display issue

Non-public news items didn't appear at all.
This commit is contained in:
Polonkai Gergely 2012-07-23 18:09:15 +02:00
parent acc64ee66d
commit ff1e3fd9fc

View File

@ -21,7 +21,7 @@ class NewsExtension extends \Twig_Extension
{
$newsRepo = $this->_doctrine->getRepository('KekRozsakFrontBundle:News');
$searchCriteria = array();
if (!$this->_securityContext->getToken() instanceof Symfony\Component\Security\Core\Authentication\Token\AnonymousToken)
if (!is_object($this->_securityContext->getToken()->getUser()))
$searchCriteria['public'] = true;
$news = $newsRepo->findBy($searchCriteria, array('createdAt' => 'DESC'), 4);