public function findBodyModel($contentId = null) { if ($contentId === null) { return new ContentPage(); } else { $ret = ContentPage::findOne(['content_id' => $contentId]); if ($ret === null) { $ret = new ContentPage(); $ret->content_id = $contentId; $ret->body = ''; $ret->save(); } return $ret; } }
public function getDetail($id) { $model = Content::getBody(ContentPage::className(), [ 'a.id' => $id ])->one(); return [ 'model' => $model ]; }
public function init() { parent::init(); $this->content_type = 'page'; $this->bodyClass = ContentPage::className(); }