在此代码中:
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() 忽略 my $where子句,并检索所有记录,而不仅仅是使用type=0检索记录。
我试过用array('type = 0'),同样的问题。我在mapper fetchAll()方法中做了一个fetchAll(),但是没有什么特别的东西出现,数组似乎没有问题。
我该怎么办?我完全不知道为什么会这样,看来我是唯一一个在互联网上有这个问题的人。
发布于 2013-09-12 15:35:56
$rowSet = $this->dbTable->fetchAll($where = null, $order = null, $count = null, $offset = null);只需在mapper类中用$rowSet = $this->dbTable->fetchAll($where, $order, $count, $offset);替换即可。因为当您调用此方法时,将null赋值给方法参数。这是方法调用,而不是初始化。
https://stackoverflow.com/questions/18768026
复制相似问题