/** * @return \im\cms\models\widgets\WidgetArea */ protected function loadModel() { $condition = ['code' => $this->code]; $condition['template_id'] = $this->template ? $this->template->id : null; return WidgetAreaModel::findOne($condition); }