I have a query like this:
$query = "select run_record_detail.id from
(select max(id) as run_record_id from run_record where delete_flag=0 group by test_run_id) rr
inner join
run_record_detail
on rr.run_record_id = rr.run_record_id
where delete_flag=0 and test_case_id IN (:ids)";
$rsm = new \Doctrine\ORM\Query\ResultSetMapping();
$rsm->addEntityResult('\Test\Entity\RunRecordDetail', 'run_record_detail');
$rsm->addFieldResult('run_record_detail', 'id', 'id');
$query = $this->getEntityManager()->createNativeQuery($query, $rsm);
$query->setParameter('ids', $testCaseIdArray);
$result = $query->getResult();
I am trying to use ResultsetMapping to bind run_record_detail to RunRecordDetail object. I want RunRecordDetail object in the output. But I am getting only its id(as I have selected ). Please help me getting this object. I am following Doctrine doc http://doctrine-orm.readthedocs.org/en/latest/reference/dql-doctrine-query-language.html