how to create pages and at the same time creating her children?
I try using populate defaults
public function populateDefaults(){
parent::populateDefaults();
$p = new Page();
$p->Title = 'TitlePage';
$p->MenuTitle = 'MenuTitle';
$p->URLSegment = $p->Title;
$p->Content = '';
$p->Status = 'Published';
$p->write();
$p->doRestoreToStage();
$p->publish('Stage', 'Live');
$p->flushCache();
}
Any idea to create this structure?