Last active
August 29, 2015 14:21
-
-
Save muskie9/80067fea285d1cb31ba2 to your computer and use it in GitHub Desktop.
Base installation with TestPage that hides Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the error from the BuildTask:
http://puu.sh/hSvgv/57c2e5f4b0.png