Problem with paginate method

53 views
Skip to first unread message

Uwe Wagner

unread,
Jan 14, 2019, 6:29:42 AM1/14/19
to Fat-Free Framework
The "ORDER BY" expressed as 'order'=>'...' clause does not seem to work as shown below:

$grenzwerte = new DB\SQL\Mapper($db,'chemdb_agw');
$list = $grenzwerte->paginate($page-1, $limit, array('order'=>'gw_bezeichnung'));

Is it possible to combine a exec method with paginate? Something like:
$list = $f3->get('DB')->exec("SELECT * FROM chemdb_agw ORDER BY gw_bezeichnung")->paginate($page-1, $limit)




ikkez

unread,
Jan 14, 2019, 8:45:12 AM1/14/19
to Fat-Free Framework
paginate works as expected. it is not possible to combine the result from exec with any mapper method.. what you want is to add "LIMIT 10,10" or something.

Uwe Wagner

unread,
Jan 14, 2019, 10:52:30 AM1/14/19
to Fat-Free Framework

It works now with the folloing changes:

$options = array('order'=>'gw_bezeichnung DESC');
$list = $grenzwerte->paginate($page-1, $limit, NULL, $options);


The documentation on this point is not entirely clear.

bcosca

unread,
Jan 14, 2019, 7:25:20 PM1/14/19
to Fat-Free Framework
The documentation is quite clear on this point. The third argument is meant to be the query filter (WHERE clause) and not the additional modifiers (ORDER and LIMIT clauses).
Reply all
Reply to author
Forward
0 new messages