Issues

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

Resolved in r16293. Merged to release-1.8 in r16294.

Same problem occurred to me, I took the class Zend_Paginator_Adapter_DbSelect of the trunk.

Ramon: can you try to reproduce the error and paste the corresponding query?

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.