选择特定列Zend Framework

时间:2015-01-11 11:51:27

标签: php mysql zend-framework pagination

我想将控制器更改为可以从两列(id,number)中选择

public function invalidcustomersAction()
    {
        $smsModel = new Model_SimInCust(); 
        $select = $smsModel->select();
        $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select));
        $paginator ->setItemCountPerPage(5)
        ->setCurrentPageNumber($this->_getParam('page',1));
        $this->view->paginator = $paginator;
    }   

我的模特已经有了这个

<?php
class Model_SimInCust extends Zend_Db_Table_Abstract
{
    protected $_name = 'invalid';
    protected $_schema  = 'invalid_sim';

}

1 个答案:

答案 0 :(得分:1)

选择编辑为:

$select = $smsModel->select()->from($smsModel, array('id','number'));