Skip to content

Commit

Permalink
Join posts authors when quering latests posts
Browse files Browse the repository at this point in the history
  • Loading branch information
voronkovich committed May 8, 2017
1 parent 72bddba commit c366c05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/AppBundle/Repository/PostRepository.php
Expand Up @@ -38,8 +38,9 @@ public function findLatest($page = 1)
{
$query = $this->getEntityManager()
->createQuery('
SELECT p, t
SELECT p, a, t
FROM AppBundle:Post p
JOIN p.author a
LEFT JOIN p.tags t
WHERE p.publishedAt <= :now
ORDER BY p.publishedAt DESC
Expand Down

0 comments on commit c366c05

Please sign in to comment.