Fixed main page controller function
Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
@@ -6,10 +6,22 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
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()));
|
||||
}
|
||||
|
||||
public function articleAction($articleSlug)
|
||||
{
|
||||
$article = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBySlug($articleSlug);
|
||||
|
||||
if (!$article)
|
||||
throw $this->createNotFoundException('A keresett cikk nem létezik!');
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Default:article.html.twig', array(
|
||||
'article' => $article
|
||||
));
|
||||
|
Reference in New Issue
Block a user