2012-08-15 12:11:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace KekRozsak\FrontBundle\Controller;
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Description of NewsController
|
|
|
|
*
|
|
|
|
* @author polesz
|
2012-08-29 10:43:25 +00:00
|
|
|
*
|
|
|
|
* @Route("/hirek")
|
2012-08-15 12:11:05 +00:00
|
|
|
*/
|
|
|
|
class NewsController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
2012-08-17 14:18:43 +00:00
|
|
|
* @return array
|
2012-08-29 10:43:25 +00:00
|
|
|
*
|
|
|
|
* @Route("/oldalso-lista.html", name="KekRozsakFrontBundle_newsSideList", options={"expose": true})
|
|
|
|
* @Template()
|
2012-08-15 12:11:05 +00:00
|
|
|
*/
|
|
|
|
public function sideListAction()
|
|
|
|
{
|
|
|
|
$newsRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:News');
|
|
|
|
$searchCriteria = array();
|
|
|
|
if (
|
|
|
|
!is_object($this->get('security.context')->getToken())
|
|
|
|
|| !is_object($this->get('security.context')->getToken()->getUser())
|
|
|
|
) {
|
2012-08-17 14:18:43 +00:00
|
|
|
$searchCriteria['public'] = true;
|
2012-08-15 12:11:05 +00:00
|
|
|
}
|
|
|
|
|
2012-08-19 10:20:39 +00:00
|
|
|
$news = $newsRepo->findBy($searchCriteria, array('sticky' => 'DESC', 'createdAt' => 'DESC'), 4);
|
2012-08-17 14:18:43 +00:00
|
|
|
|
2012-08-15 12:11:05 +00:00
|
|
|
return array(
|
2012-08-15 12:25:08 +00:00
|
|
|
'recentNews' => $news,
|
2012-08-15 12:11:05 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|