public function test() {
$query = $this->getEntityManager()->createQueryBuilder()
->select('s','su','rv')
->from(Project::class, 's')
->leftJoin('s.sub_projects', 'su')
->leftJoin('su.reports_validation', 'rv')
->getQuery()
;
return $query->getResult();
}
2/
/**
* get sub projects
*
* @param Project $project
*
* @return array
*/
public function getSubProjects(Project $project): array {
$query = $this->getEntityManager()->createQueryBuilder()
->select('s.id', 's.name')
->from(SubProject::class, 's')
->where('s.project = :project')->setParameter('project', $project)
->getQuery()
;
try {
return $query->getResult();
} catch (\Doctrine\ORM\NoResultException $e) {
return [];
}
}