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.

57 lines
1.6 KiB

<?php
namespace KekRozsak\FrontBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
/**
* @Route("/blog")
*/
class BlogController extends Controller
{
/**
* @Route("/", name="KekRozsakFrontBundle_blogList")
* @Template()
*/
public function listAction()
{
$query = $this
->getDoctrine()
->getEntityManager()
->createQuery('
SELECT
p
FROM
KekRozsakFrontBundle:BlogPost p
LEFT JOIN
p.group g
LEFT JOIN
g.members m
WHERE
(
(
p.group IS NULL
OR m.user = :user
)
AND p.published = true
)
OR p.createdBy = :user
');
$query->
setParameter(
'user',
$this
->get('security.context')
->getToken()
->getUser()
->getId()
);
$blogPosts = $query->getResult();
return array(
'posts' => $blogPosts,
);
}
}