title: zend framework fetch all ORDER BY desc
body: <p>Im trying to get the company name ORDER BY ASC or DECS but what I have tired doesnt seem to work...Im new to Zend Framework and inherited this application, now having to make updates to it, I have been reading Zend docs on their site...any feedback, examples would be appreciated </p>
  
  <p>This is in my model </p>
  
  <pre><code>class Application_Model_DbTable_X2payUsers extends 
  Zend_Db_Table_Abstract
  {
  protected $_name = 'users';
  protected $_primary = 'id';
  
  public function getAllUsers(){
      $users = $this-&gt;fetchAll(Zend_db::FETCH_OBJ);
      // $db-&gt;setFetchMode(Zend_Db::FETCH_OBJ);
      // $users = $db-&gt;fetchAll('SELECT * FROM users ORDER BY DECS');
  
  
      $result = array();
      foreach($users as $user){
          $result [$user-&gt;id]= $user-&gt;company_name;
      }
  
      return $result;
  }
  </code></pre>
  
  <p>This is the transaction filter form Im working with</p>
  
  <pre><code> class Application_Form_TransactionFilter extends Zend_Form
   {
  
  private $_company = '';
  
  public function __construct($company = '') {
      $this-&gt;_company = $company;
  
      return parent::__construct();
  }
  
  public function init()
  {
      $this-&gt;setName('transaction-filter');
      $this-&gt;setAction('');
      $this-&gt;setMethod('GET');
  
      $users_table = new Application_Model_DbTable_X2Users();
      $users = $users_table-&gt;getAllUsers();
      // -&gt;orderby('company_name ASC');
  
      $company = new Zend_Form_Element_Select('company');
      $company-&gt;addFilter('StripTags')
              -&gt;setAttrib('class', 'form-control')
              -&gt;addValidator('NotEmpty') 
              -&gt;setRequired(true)
              -&gt;addFilter('StringTrim')
              -&gt;removeDecorator('label')
              -&gt;removeDecorator('htmlTag')
              -&gt;removeDecorator('Errors');    
      $company-&gt;addMultiOptions(
          array(''=&gt;'-- Select Company --')
      );
      $company-&gt;addMultiOptions($users);
      $company-&gt;getValidator('NotEmpty')-&gt;setMessage('Please select a company');
  
      $company-&gt;setValue($this-&gt;_company);
  
      $submit = new Zend_Form_Element_Submit('submit');
      $submit-&gt;setAttrib('class', 'btn btn-default')
              -&gt;setLabel('Submit')
              -&gt;removeDecorator('DtDdWrapper')
               -&gt;removeDecorator('label')
               -&gt;removeDecorator('htmlTag');      
      $this-&gt;setDecorators(array(array('ViewScript',
              array('viewScript' =&gt; '_transaction_filter.phtml'))));        
      $this-&gt;addElements(array($company, $submit));  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is the code in the transaction file</p>
  
  <pre><code>   &lt;?= $this-&gt;filter ?&gt;
  </code></pre>