<?php
class Drug extends AppModel {
	var $name = 'Drug';
	var $displayField = 'name';
	
  var $validate = array(				 				 
	       'type_d1' => array(
				'required' => 'notEmpty'
	       ),
	       //'category' => array(
			//	'required' => 'notEmpty'
	       //),					 				 			 
	       'name' => array(
				'required' => 'notEmpty'
	       )
	);	
	
	public $hasMany = array(
		'MedicationTreatment' => array(
			'className' => 'MedicationTreatment',
			'foreignKey' => 'drug_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)	
	);
	
    function searchListDrugName($name) {
		return $this->find('all', array('conditions'=>array('Drug.name 
				LIKE'=>'%'.$name.'%'),
				'fields' => array('id', 'name'),'order' => 'name ASC'));
	}		

}
?>