ZF-7127: Problem with Where-clause in select for paginator
Description
Until version 1.8.3 the following code worked perfectly but with the update to ZF 1.8.4 the following error occurs: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'c.ModuleName' in 'where clause'
$select = $this->db->select();
$select->from(array("c" => "mvc_pagecalls"),
array("ModuleName", "ControllerName", "ActionName", "ObjectID"))
->group("c.ModuleName")
->group("c.ControllerName")
->group("c.ActionName")
->group("c.ObjectID")
->where("c.ModuleName = ?", 'admin');
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
$paginator->setItemCountPerPage(20);
$paginator->setCurrentPageNumber($this->_getParam("page", 1));
$this->view->paginator = $paginator;
so i tried to dump the sql-string ($select->__tostring) and execute it in the phpmyadmin. The query was valid and successful.
So it seems as the version 1.8.4 has a bug in Db_Select or Paginator.
Comments
Posted by Jurrien Stutterheim (norm2782) on 2009-06-25T14:03:15.000+0000
Resolved in r16293. Merged to release-1.8 in r16294.
Posted by Ramon Henrique Ornelas (ramon) on 2009-08-23T06:52:16.000+0000
Same problem occurred to me, I took the class Zend_Paginator_Adapter_DbSelect of the trunk.
Posted by Jurrien Stutterheim (norm2782) on 2009-08-26T07:54:25.000+0000
Ramon: can you try to reproduce the error and paste the corresponding query?
Posted by Ramon Henrique Ornelas (ramon) on 2009-08-29T09:00:47.000+0000
Jurrien Stutterheim: error was in version 1.8.4 solved my problem when I took the svn/trunk, and was resolved in version 1.9.
Reported in ZF-7259.
No problem.