Hello zfers,

I have problem with Zend_Paginator, I'm using
Zend_Paginator_Adapter_DbTableSelec adapter, heer is the code:

$feed = new Default_Model_Feed();

// Prepare paginator
$content = new Default_Model_Content();
$paginator = new Zend_Paginator(
    new Zend_Paginator_Adapter_DbTableSelect(
        $content->select()
            ->where($content->getAdapter()->quoteInto('FeedId = ?',
$feedId))
    )
);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage(self::ENTRIES_PER_PAGE);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('partials/paginator.phtml');

View partial is default, taken from
http://framework.zend.com/manual/en/zend.paginator.usage.html .

So, everithing works perfect, except one annoying thing, query is wxwcuted
twice. Here is FirePHP profile:

0.00187    DESCRIBE `Content`    NULL
0.00499    SELECT COUNT(*) AS `zend_paginator_row_count` FROM `Content`
WHERE (FeedId = '1')    NULL
0.00208    DESCRIBE `Feed`    NULL
0.00052    SELECT `Feed`.* FROM `Feed` WHERE (((`Feed`.`FeedId` = 1)))   
NULL
0.03135    SELECT `Content`.* FROM `Content` WHERE (FeedId = '1') LIMIT 100
OFFSET 10700    NULL
0.03184    SELECT `Content`.* FROM `Content` WHERE (FeedId = '1') LIMIT 100
OFFSET 10700    NULL

Any idea?

Regards,
Saša Stamenković

-- 
View this message in context: 
http://www.nabble.com/Zend_Paginator-executes-query-twice-tp23736642p23736642.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to