1

I created a query that returns all associated projects from the user ID:

return $this->createQueryBuilder('p')
            ->innerJoin('p.project_contributors', 'pc')
            ->Where('p.project_owner = :val')
            ->orWhere('pc.id = :val')
            ->setParameter('val', $value)
            ->getQuery()
            ->getResult()
;

The problem with this is that if a project has no contributors, and only a project owner, then this will return null. Why is that?

Project contributors are its own entity that are associated to projects.

yivi
  • 42,438
  • 18
  • 116
  • 138
Majo0od
  • 2,278
  • 10
  • 33
  • 58
  • 2
    Does this answer your question? [What's the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN?](https://stackoverflow.com/questions/5706437/whats-the-difference-between-inner-join-left-join-right-join-and-full-join) – yivi Aug 26 '21 at 05:53
  • You are using an inner join. You only get results when there is a match in "both sides" of the join. – yivi Aug 26 '21 at 05:54

0 Answers0