I'm working on paginated results which require an "items 1-5 of 50"
type functionality. While it's possible to limit a result set from
Zend_Db_Table there appears to be no way to get a count of ALL rows
without reverting to writing a Zend_Db_Select query which seems a bit
tedious.
I'd like to be able to do something like this...
$table = new RoundTable();
$db = $table->getAdapter();
// SELECT * FROM round_table
// WHERE noble_title = "Sir"
// ORDER BY first_name
// LIMIT 10 OFFSET 20
$where = $db->quoteInto('noble_title = ?', 'Sir');
$order = 'first_name';
$count = 10;
$offset = 20;
$rowset = $table->fetchAll($where, $order, $count, $offset);
// SELECT COUNT(*) FROM round_table
// WHERE noble_title = "Sir"
$row_count = $table->fetchCount( $where );
I realise for some circumstances this is the less than ideal way to
do things and may well be somewhat database specific but I'm
interested to hear any thoughts/plans about this functionality.
Thanks,
Nick