public function loadModel($table_id, $id = NULL) { $form = Form::model()->findByPk($table_id); $entryModel = Entry::forTable($form->TABLE_NAME); if ($id != NULL) { $model = $entryModel->findByPk($id); } else { $model = $entryModel->findAll(); //$model=$entryModel; } if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function model($className = __CLASS__) { if (isset(self::$_models[$className])) { return self::$_models[$className]; } else { $model = Entry::forTable($className); return $model; } }