开发者

sfDoctrinePager with custom query returned only one row

开发者 https://www.devze.com 2023-02-22 05:59 出处:网络
I\'ve tried to combine my Doctrine_Query and sfDoctrinePager, but when I fetch the results, it\'s always return one row (when I run the generated query in my database it was 开发者_如何学编程normal)

I've tried to combine my Doctrine_Query and sfDoctrinePager, but when I fetch the results, it's always return one row (when I run the generated query in my database it was 开发者_如何学编程normal)

this is my code:

$pelanggan = Doctrine_Query::create()
                            ->addSelect('l.id as id_transaksi,
                                         l.jenis_bbm as jenis_bbm,
                                         SUM(volume) as vol,
                                         k.nama_kapal as nama_kapal
                                        ')
                            ->from('laut_request_message l')->innerJoin('l.Kapal k')
                            ->groupBy('l.id_kartu')
                            ->orderBy('id_edc')
                            ->where('volume > 0');

$pager = new sfDoctrinePager('laut_request_message', sfConfig::get('app_max_row_per_page',20));
    $pager->setPage($request->getParameter('page',1));
    $pager->setQuery($pelanggan);
    $pager->init();

When i get the total row using $pager->count() it return all row in that query, but when I get the total result in the current page (count($pager->getResults()) it is only return a row.

Could you guys give me an advice? or may be another solutions ?

0

精彩评论

暂无评论...
验证码 换一张
取 消