public function loadModel($id) { $m = CledCalendarExceptionDates::model(); // apply scope, if available $scopes = $m->scopes(); if (isset($scopes[$this->scope])) { $m->{$this->scope}(); } $model = $m->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('D2calendarModule.crud', 'The requested page does not exist.')); } return $model; }