Пример #1
0
 /**
  * fourth sequence 
  * Method untuk meload data tenant berdasarkan primary key
  */
 public function loadModel($id)
 {
     $model = Tenant::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #2
0
 public function actionGetTenant()
 {
     $keyword = $_GET['q'];
     $models = Tenant::model()->findAll(array('select' => 'id_tenant, tenant_name', 'condition' => 'tenant_name LIKE :keyword', 'params' => array(':keyword' => '%' . $keyword . '%'), 'order' => 'tenant_name', 'limit' => 5));
     $suggest = array();
     foreach ($models as $model) {
         $suggest[] = array('id' => $model->id_tenant, 'text' => $model->tenant_name);
     }
     echo CJSON::encode($suggest);
 }