I need to get data from 2 tables. In fact, you just need to include one field from the 2nd table in the result of the 1st table based on the form key.
I researched and found a way to do this.
$qb->select(array('a', 'c')) ->from('Sdz\BlogBundle\Entity\Article', 'a') ->leftJoin('a.comments', 'c');
When I implemented it, it shows the error Error: the class does not have associations with names, which are obvious, because comments are not a field of an entity table. I am confused about how to determine the second table from which to extract the field, since a.comments refers to the article table.
source share