Anish Abraham Anish Abraham - 5 months ago 18
PHP Question

zend pagination using doctrine native query

I've build a pagination in Zend framework 1.12 using native query like

$nativeQuery = $em->createNativeQuery("SELECT u.*,l.* FROM `table1` u INNER JOIN `table2` l ON u.`x`=l.`y` WHERE l.`ub_id`='10'", $rsm);

given rsm as,

$rsm = new ResultSetMapping();
$rsm->addEntityResult('Models\objectname1(table1)', 'su');
$rsm->addFieldResult('su', 'x', 'xx');
$rsm->addFieldResult('su', 'y','yy');
$rsm->addJoinedEntityResult('Models\objectname2(table2)', 'sul', 'su', 'x');
$rsm->addFieldResult('sul', 'xid', 'idx');

I've run the same query in db and got more than 1 rows. But the value of paginator array is null what is the issue.

I have referred this . but not working for me.


Your code looks good. Please check whether you have properly called entityManager