Get single row result with Doctrine NativeQuery

后端 未结 6 525
独厮守ぢ
独厮守ぢ 2020-12-15 02:26

I\'m trying to get a single row returned from a native query with Doctrine. Here\'s my code:

$rsm = new ResultSetMapping;
$rsm->addEntityResult(\'VNNCoreB         


        
6条回答
  •  我在风中等你
    2020-12-15 03:08

    To fetch single row

    $result = $this->getEntityManager()->getConnection()->fetchAssoc($sql)
    

    To fetch all records

    $result = $this->getEntityManager()->getConnection()->fetchAll($sql)
    

    Here you can use sql native query, all will work without any issue.

提交回复
热议问题