The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ
blueroses.hu project repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kekrozsak/src/KekRozsak/FrontBundle/Twig/NewsExtension.php

38 lines
919 B

<?php
namespace KekRozsak\FrontBundle\Twig;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\Security\Core\SecurityContextInterface;
class NewsExtension extends \Twig_Extension
{
protected $_doctrine;
protected $_securityContext;
public function __construct(RegistryInterface $doctrine, SecurityContextInterface $securityContext)
{
$this->_doctrine = $doctrine;
$this->_securityContext = $securityContext;
}
public function getGlobals()
{
$newsRepo = $this->_doctrine->getRepository('KekRozsakFrontBundle:News');
$searchCriteria = array();
if (!is_object($this->_securityContext->getToken()) || !is_object($this->_securityContext->getToken()->getUser()))
$searchCriteria['public'] = true;
$news = $newsRepo->findBy($searchCriteria, array('createdAt' => 'DESC'), 4);
return array(
'recentNews' => $news,
);
}
public function getName()
{
return 'News';
}
}