我有一个项目列表,我想按字母顺序排序,继承我的代码:
public function indexAction()
{
$this->authoriseUser();
$this->view->assign('title', 'Clubs');
$this->view->headTitle($this->view->title, 'PREPEND');
$clubs = new Application_Model_DbTable_Clubs();
$this->view->clubs = $clubs->fetchAll();
$select = $clubs->select();
$select->order('club_name ASC');
}
Run Code Online (Sandbox Code Playgroud)
怎么了?因为它不起作用..
谢谢
您需要将select对象传递给fetchAll方法
public function indexAction()
{
$this->authoriseUser();
$this->view->assign('title', 'Clubs');
$this->view->headTitle($this->view->title, 'PREPEND');
$clubs = new Application_Model_DbTable_Clubs();
$select = $clubs->select()
->order('club_name ASC');
$this->view->clubs = $clubs->fetchAll($select);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13597 次 |
| 最近记录: |