Zend Framework 2 Db\Adapter\Adapter query resultset like ZF1

前端 未结 5 1502
广开言路
广开言路 2021-02-08 18:40

Just need a hand understanding some simple database queries in ZF2. In ZF1 I have simple methods like this:

public function recordset()
{
// listing of all reco         


        
5条回答
  •  南旧
    南旧 (楼主)
    2021-02-08 18:58

    My English is very rotten
    I also encountered this problem,$returnType Defined in Zend\Db\ResultSet\ResultSet
    we can give third argument for Zend\Db\Adapter\Adapter,like this

    $adapter = new Zend\Db\Adapter\Adapter($db_config,null,new Zend\Db\ResultSet\ResultSet('array'));
    $re = $adapter->query('select * from mooncake', $adapter::QUERY_MODE_EXECUTE);
    $s = $re->current();
    var_dump($s);
    

    now,$s is array

提交回复
热议问题