Php 使用本机查询的zend分页
我已经在Zend framework 1.12中使用本机查询构建了分页,如Php 使用本机查询的zend分页,php,zend-framework,doctrine-orm,Php,Zend Framework,Doctrine Orm,我已经在Zend framework 1.12中使用本机查询构建了分页,如 $nativeQuery = $em->createNativeQuery("SELECT u.*,l.* FROM `table1` u INNER JOIN `table2` l ON u.`x`=l.`y` WHERE l.`ub_id`='10'", $rsm); 鉴于rsm为 $rsm = new ResultSetMapping(); $rsm->addEntityResu
$nativeQuery = $em->createNativeQuery("SELECT u.*,l.* FROM `table1` u INNER JOIN `table2` l ON u.`x`=l.`y` WHERE l.`ub_id`='10'", $rsm);
鉴于rsm为
$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');
我在db中运行了相同的查询,得到了超过1行。但是paginator数组的值为null,这是个问题
我已经提到了。但对我不起作用。你的代码看起来不错。请检查您是否已正确呼叫entityManager
$this->getDoctrine()->getManager()
你的代码看起来不错。请检查您是否已正确呼叫entityManager
$this->getDoctrine()->getManager()