<?php

App::uses('Model', 'Model');



/**

 * Application model for Cake.

 *

 * Add your application-wide methods in the class below, your models

 * will inherit them.

 *

 * @package       app.Model

 */



class Subdepot extends AppModel {

	/*public $belongsTo  = array(

						'Region' => array('className' => 'Region', 'foreignKey' => 'region_id'),

						'Depot' => array('className' => 'Depot', 'foreignKey' => 'depot_id')

					);*/



	public function getList($region_id = 0){
		$conditions = array();
		if ($region_id){

			$conditions = array('region_id'=>$region_id);

		}	
		return $this->find('list', array( 'fields'=>array('id', 'title'),'conditions'=>$conditions, 'order'=>array('title'=>'asc')));

	}
	public function getListdp($depot_id = 0){
		$conditions = array();
		if ($depot_id){

			$conditions = array('depot_id'=>$depot_id);

		}	
		return $this->find('list', array( 'fields'=>array('id', 'title'),'conditions'=>$conditions, 'order'=>array('title'=>'asc')));

	}

}

