<?php defined('SYSPATH') or die('No direct script access.');

class Model_Category extends ORM
{
   protected $_has_many = array('sales' => array('model'=>'sale', 
                                                 'through'=>'categorysales'));
   
   public function getCategories(){
        
        $categories = ORM::factory('category')-> find_all();
        $categories_arr = array();
        foreach($categories as $category){
            $categories_arr [$category->id] = $category->catname;
        }
        return $categories_arr;
    }
}