/** * Finds the MeetingTimeChoice model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MeetingTime the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MeetingTimeChoice::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public static function add($meeting_time_id, $user_id, $suggested_by) { $model = new MeetingTimeChoice(); $model->meeting_time_id = $meeting_time_id; $model->user_id = $user_id; // set initial choice status based if they suggested it themselves if ($suggested_by == $user_id) { $model->status = self::STATUS_YES; } else { $model->status = self::STATUS_UNKNOWN; } $model->save(); }
/** * @return \yii\db\ActiveQuery */ public function getMeetingTimeChoices() { return $this->hasMany(MeetingTimeChoice::className(), ['meeting_time_id' => 'id']); }