Skip to content

Instantly share code, notes, and snippets.

@muskie9
Last active August 29, 2015 14:21
Show Gist options
  • Save muskie9/80067fea285d1cb31ba2 to your computer and use it in GitHub Desktop.
Save muskie9/80067fea285d1cb31ba2 to your computer and use it in GitHub Desktop.
Base installation with TestPage that hides Page
<?php
class TestPage extends Page{
private static $singular_name = 'Test Page';
private static $plural_name = 'Test Pages';
private static $description = 'A test page';
private static $hide_ancestor = 'Page';
private static $db = array();
private static $has_one = array();
private static $has_many = array();
private static $many_many = array();
private static $many_many_extraFields = array();
private static $belongs_many_many = array();
private static $defaults = array();
public function getCMSFields(){
$fields = parent::getCMSFields();
$this->extend('updateCMSFields', $fields);
return $fields;
}
}
class TestPage_Controller extends Page_Controller{
public function init(){
parent::init();
}
}
/* PageUpdateTask that errors at SiteTree.php:1658 */
class PageUpdateTask extends BuildTask{
protected $title = 'Page Update Task';
protected $description = 'A task to update Page to TestPage';
protected $enabled = true;
function run($request){
$pages = Page::get();
foreach($pages as $page){
$page->ClassName = 'TestPage';
$page->write();
$page->doPublish();
}
}
}
@muskie9
Copy link
Author

muskie9 commented May 19, 2015

Here is the error from the BuildTask:

http://puu.sh/hSvgv/57c2e5f4b0.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment