revision_id) { $model->revision_at = time(); $page = Page::create( $model->title, $model->slug, $model->content, new Meta( $model->meta->title, $model->meta->description, $model->meta->keywords ) ); $page->revision_at = $model->updated_at; $page->revision_id = $model->id; $page->type = Page::TYPE_REVISION; //$page->tree = 2; $parent = Page::find()->andWhere(['slug' => 'temp'])->andWhere(['depth' => 0])->one(); $page->appendTo($parent); $page->save(); } } }