2012-07-01 08:02:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace KekRozsak\FrontBundle\Controller;
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
|
|
|
|
|
|
class DefaultController extends Controller
|
|
|
|
{
|
2012-07-01 18:29:59 +00:00
|
|
|
public function homepageAction()
|
|
|
|
{
|
|
|
|
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('main_page' => 1), true, array('created_at', 'DESC'), 1);
|
|
|
|
if (!$mainPageArticle)
|
|
|
|
throw $this->createNotFoundException('A keresett cikk nem létezik!');
|
|
|
|
|
|
|
|
return $this->forward('KekRozsakFrontBundle:Default:article', array('articleSlug' => $mainPageArticle->getSlug()));
|
|
|
|
}
|
|
|
|
|
2012-07-01 17:11:31 +00:00
|
|
|
public function articleAction($articleSlug)
|
|
|
|
{
|
|
|
|
$article = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBySlug($articleSlug);
|
|
|
|
|
2012-07-01 18:29:59 +00:00
|
|
|
if (!$article)
|
|
|
|
throw $this->createNotFoundException('A keresett cikk nem létezik!');
|
|
|
|
|
2012-07-01 17:11:31 +00:00
|
|
|
return $this->render('KekRozsakFrontBundle:Default:article.html.twig', array(
|
|
|
|
'article' => $article
|
|
|
|
));
|
|
|
|
}
|
2012-07-01 08:02:35 +00:00
|
|
|
}
|