2

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 ?

HQM
  • 558
  • 1
  • 3
  • 15

0 Answers0