Drug::model PHP Method

model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : Drug
return Drug the static model class
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

Usage Example

 public function actionFindDrug()
 {
     $return = array();
     if (isset($_GET['term']) && ($term = $_GET['term'])) {
         $criteria = new CDbCriteria();
         $criteria->compare('LOWER(name)', strtolower($term), true, 'OR');
         $criteria->compare('LOWER(aliases)', strtolower($term), true, 'OR');
         foreach (Drug::model()->active()->findAll($criteria) as $drug) {
             $return[] = array('label' => $drug->tallmanlabel, 'value' => $drug->id);
         }
     }
     echo json_encode($return);
 }
All Usage Examples Of Drug::model