Reputation: 1919
i have many class in model directory that those are extend of Zend_Db_Table_Abstract.
but i need use of zend_paginator and this need to result of Zend_Db_Select !!
so when i use of this code (productCat is a model class)
$productCat = new ProductCat();
$rows = $productCat->FetchOrderByPriority();
// Get a Paginator object using Zend_Paginator's built-in factory.
$paginator = Zend_Paginator::factory($rows);
$this->view->paginator = $paginator;
it don`t work!
it show me this error :
Catchable fatal error: Object of class Zend_Db_Table_Row could not be converted to string in
this is my view code :
<ul><?php foreach ($this->paginator as $item): ?>
<li><?php echo $item; ?></li><?php endforeach; ?></ul>
is there any idea?
Upvotes: 0
Views: 790
Reputation: 3285
Pagination definitely works. The problem is in your view where you're trying to echo $item
.
And it obviously doesn't work since Zend_Paginator::factory($rows)
has returned a rowset; so when you're iterating over $paginator
object, you're getting objects of Zend_Db_Table_Row
type, and you simply cannot echo
them.
What you're trying to do, I believe, is to echo
a particular property of the item
object, something like:
echo $item->name;
Upvotes: 2