revision_id) { $model->revision_at = time(); $pageForm = new PageForm($model); $page = Page::create( $pageForm, $model->slug, Page::TYPE_REVISION ); $page->revision_at = $model->updated_at; $page->revision_id = $model->id; $parent = Page::find()->andWhere(['slug' => 'temp'])->andWhere(['depth' => 0])->one(); $page->appendTo($parent); $page->save(); } } }