Can you please convert it to DQL :
SELECT molecule.cas, molecule.id_molecule, molecule.statutvlep8h, statutvlepct,
vlep8h_mg, vlepct_mg,molecule.unitevlep, prelevement.id_laboratoire
FROM thym_dev.molecule
INNER JOIN thym_dev.prelevement
WHERE molecule.id_molecule = prelevement.id_molecule
UNION ALL
SELECT molecule.cas, molecule.id_molecule, molecule.statutvlep8h, statutvlepct,
vlep8h_mg, vlepct_mg,molecule.unitevlep, analyse.id_laboratoire
FROM thym_dev.molecule
INNER JOIN thym_dev.analyse
WHERE molecule.id_molecule = analyse.id_molecule;
I get the answer :
$queryBuilder0 = "
SELECT molecule.molecule, molecule.cas, molecule.statutvlep8h,molecule.statutvlepct,molecule.vlep8hMg, molecule.vlepctMg,molecule.unitevlep,IDENTITY(prelevement.laboratoire)
FROM AppBundle:Molecule molecule
INNER JOIN AppBundle:Prelevement prelevement
WHERE prelevement.molecule= molecule.id
";
$queryBuilder1 = "
SELECT molecule.molecule , molecule.cas, molecule.statutvlep8h, molecule.statutvlepct, molecule.vlep8hMg, molecule.vlepctMg,molecule.unitevlep,IDENTITY(analyse.laboratoire)
FROM AppBundle:Molecule molecule
INNER JOIN AppBundle:Analyse analyse
WHERE analyse.molecule= molecule.id
";
$results = array_merge($this->_em->createQuery($queryBuilder0)->getResult(), $this->_em->createQuery($queryBuilder1)->getResult());