Skip to content

Commit c366c05

Browse files
committed
Join posts authors when quering latests posts
1 parent 72bddba commit c366c05

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/AppBundle/Repository/PostRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ public function findLatest($page = 1)
3838
{
3939
$query = $this->getEntityManager()
4040
->createQuery('
41-
SELECT p, t
41+
SELECT p, a, t
4242
FROM AppBundle:Post p
43+
JOIN p.author a
4344
LEFT JOIN p.tags t
4445
WHERE p.publishedAt <= :now
4546
ORDER BY p.publishedAt DESC

0 commit comments

Comments
 (0)