예제 #1
0
 public function getAccessCodes()
 {
     return $this->hasMany(AccessCode::className(), ['ticket_id' => 'id']);
 }
 public function getAccessCode()
 {
     return $this->hasOne(AccessCode::className(), ['id', 'access_code_id']);
 }
 /**
  * Finds the AccessCode model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return AccessCode the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AccessCode::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }