protected function findModel($id) { if (($model = Variable::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function checkExist() { if ($this->isNewRecord || $this->id != $this->oldAttributes['id']) { $ret = Variable::findOne($this->id); return $ret !== null; } return false; }