Zend Framework ORDER BY

15,319

You need to pass the select object to the fetchAll method

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);
}
Share:
15,319
Rex89
Author by

Rex89

Updated on June 04, 2022

Comments

  • Rex89
    Rex89 almost 2 years

    I have a list of items that I want to order in alphabetical order, heres my code:

    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');
    }
    

    Whats wrong? As it doesn't work..

    Thanks