<?php

class CompanyTable extends Doctrine_Table
{
   
    public static function getInstance()
    {
        return Doctrine_Core::getTable('Company');
    }
    public function getCompaniesList($type = -1) {
       
        $q = Doctrine_Query::create()
                ->from('Company c')->limit(50)
                ->orderBy('c.created_at DESC');        
				
		if($type!=-1){
			
			  $q->andWhere('c.type=?',$type);
		}		
				
         return $q->execute();
    }
    public function getCompanies($type = -1) {
       
        $q = Doctrine_Query::create()
                ->from('Company c')
                ->orderBy('c.created_at DESC');        
				
		if($type!=-1){
			
			  $q->andWhere('c.type=?',$type);
		}		
				
         return $q->execute();
    }
}