首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >()忽略Mapper子句

()忽略Mapper子句
EN

Stack Overflow用户
提问于 2013-09-12 15:10:01
回答 1查看 373关注 0票数 0

在此代码中:

代码语言:javascript
复制
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(),但是没有什么特别的东西出现,数组似乎没有问题。

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-09-12 15:35:56

代码语言:javascript
复制
$rowSet = $this->dbTable->fetchAll($where = null, $order = null, $count = null, $offset = null);

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18768026

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档