Hi,
I have a parent > child > grand child relationship that I want to query and get data from all 3 tables
I have been trying to do this with QueryBuilder but have not had any luck, I can not work out how to get the grandchild data
I do not know how to base my join to the GrandChild off the Child record. gc.name is always null
Any help would be appreciated
I have a parent > child > grand child relationship that I want to query and get data from all 3 tables
I have been trying to do this with QueryBuilder but have not had any luck, I can not work out how to get the grandchild data
PHP Code:
$selectJobGroup = $this->getEntityManager()
->getQueryBuilder()
->select()
->from('Parent')
->join('Child', 'c')
->leftJoin('GrandChild', 'gc', ['c.grandChildId' => 'gc.id']) // is not correct!!
->select(['id', 'status', 'createdAt', 'c.status', 'gc.name'])
->build();
Any help would be appreciated
Comment