CURDATE()) GROUP BY is_last_parent ORDER BY is_last_parent DESC", PrincipalTypeEnum::NATIONAL_FEDERATION(), PrincipalTypeEnum::REGIONAL_FEDERATION(), PrincipalTypeEnum::LOCAL_FEDERATION(), PrincipalTypeEnum::GROUPMENT(), PrincipalTypeEnum::DEPARTEMENTAL_FEDERATION(), PrincipalTypeEnum::DELEGATION(), $organization->getId() ); $rsm = new ResultSetMapping(); $rsm->addScalarResult('is_last_parent', 'is_last_parent', 'integer'); $query = $this->getEntityManager()->createNativeQuery($sql, $rsm); $result = $query->getResult(\Doctrine\ORM\Query::HYDRATE_ARRAY); foreach ($result as $a_tmp) { if ($a_tmp['is_last_parent']) { return true; } } return false; } }