0

在这段代码中:

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $records = new Application_Model_Mapper_Record();
        $this->view->records = $records->fetchAll(array('type = ?' => 0));
    }


}

... fetchAll()忽略我的$where子句并检索所有记录,而不是仅检索带有type=0.

我试过了array('type = 0'),同样的问题。我var_dump($where)在我的映射器fetchAll()方法中做了一个,但没有出现任何特别的情况,数组似乎没问题。

我应该怎么办 ?我完全不知道为什么会这样,而且看来我是唯一一个在互联网上遇到这个问题的人。

4

1 回答 1

0
$rowSet = $this->dbTable->fetchAll($where = null, $order = null, $count = null, $offset = null);

$rowSet = $this->dbTable->fetchAll($where, $order, $count, $offset);只需在您的映射器类中替换为。因为当您调用此方法时,您将 null 分配给方法参数。这是方法调用,而不是初始化。

于 2013-09-12T15:35:56.427 回答