I have been working with Zend framework and recently I have been today I have 
found issues with Zend Paginator running with Zend Cache.
I am currently running the following version of Zend Server.

Zend Server Community Edition
Version 5.0.2
 
PHP
Version 5.3.2
 
PHP Configuration File  /usr/local/zend/etc/php.ini
 
Web Server
Server Name     127.0.0.1
 
Server Software Apache/2.2.9 (Debian) PHP/5.3.2 mod_ssl/2.2.9 OpenSSL/0.9.8g
 
OS Version      Linux
 
Zend Framework
Version 1.10.5
 
Installed Path  /usr/local/zend/share/ZendFramework
 
Zend Data Cache
Version 4.0
 
Status  On
 

What I am finding is that if I use the following code with the following 
queries I will get the results from the first query even when I give it the 
second query.

I am generating the queries via this code
                        $query = $this->permits->select()
                                ->where('notice_type=?',$this->type)
                                ->order($this->bodyNamespace->orderby . ' ' . 
$this->bodyNamespace->ascdesc)
                                ->order($this->configPage->default->sort . ' ' 
. $this->configPage->default->order);

        $this->permits is an object of type Zend_Table.


I am using the following code to send both queries.

                        if ('development' == APPLICATION_ENV)
                        {
                                App_Models_Logger::info($query->__toString());
                                
App_Models_FirebugLogger::info($query->__toString());
                        }
                        $paginator = new Zend_Paginator (new 
Zend_Paginator_Adapter_DbSelect($query));
                        
$paginator->setCurrentPageNumber($this->bodyNamespace->page);
                        
$paginator->setItemCountPerPage($this->bodyNamespace->rows);
                        $this->view->paginator = $paginator;

When I send in the following two queries I will only get the results from the 
first query and the second query will result in the same results as the first.
This is the first query
SELECT `DLN_legalnotices`.* FROM `DLN_legalnotices` WHERE 
(notice_type='annual_report') ORDER BY `filed_date` desc, `filed_date` desc

This is the second query 
SELECT `DLN_legalnotices`.* FROM `DLN_legalnotices` WHERE 
(notice_type='divorce_notice') ORDER BY `respond_by` desc, `respond_by` desc

I have found that if I disable Zend_Paginator::setCache($cache); Where cache is 
my Apc caching object. The code will work just fine.

Beyond  disabling the cache which I am doing now is there anything else that 
can be done to Remedy this issue?


Reply via email to