model() 공개 정적인 메소드

Returns the static model of the specified AR class.
public static model ( string $className = __CLASS__ ) : Information
$className string active record class name.
리턴 Information the static model class
예제 #1
0
 public function init()
 {
     // Check if system is installed
     if (!Yii::app()->isInstalled()) {
         $this->redirect(array("/install"));
     }
     // TODO: filter by store
     $criteria = new CDbCriteria();
     $criteria->condition = 'bottom=1 AND status=1';
     // only active and bottom informations
     $criteria->order = 'sort_order ASC';
     $this->informations = Information::model()->findAll($criteria);
 }
예제 #2
0
 public function actionIndex()
 {
     $informations = Information::model()->findAll();
     $this->render('index', array('informations' => $informations));
 }
예제 #3
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Information the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Information::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }