21475 Posts in 5781 Topics by 2620 members
General Questions
SilverStripe Forums » General Questions » Uncaught Exception: Object->__call(): the method 'subpagestocache' does not exist on 'SiteTree'
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1051 Views |
-
Uncaught Exception: Object->__call(): the method 'subpagestocache' does not exist on 'SiteTree'

8 August 2010 at 8:12am
This is odd, anyone have an idea whats going on.
When I do a buildcache it gives me this error
Uncaught Exception: Object->__call(): the method 'subpagestocache' does not exist on 'SiteTree'
but in my page.php file I have
function allPagesToCache() {
// Get each page type to define its sub-urls
$urls = array();// memory intensive depending on number of pages
$pages = DataObject::get("SiteTree", "ClassName != 'UserDefinedForm'");foreach($pages as $page) {
$urls = array_merge($urls, (array)$page->subPagesToCache());
}// add any custom URLs which are not SiteTree instances
$urls[] = "sitemap.xml";return $urls;
}/**
* Get a list of URLs to cache related to this page
*/
function subPagesToCache() {
$urls = array();// add current page
$urls[] = $this->Link();// cache the RSS feed if comments are enabled
if ($this->ProvideComments) {
$urls[] = Director::absoluteBaseURL() . "pagecomment/rss/" . $this->ID;
}return $urls;
}function pagesAffectedByChanges() {
$urls = $this->subPagesToCache();
if($p = $this->Parent) $urls = array_merge((array)$urls, (array)$p->subPagesToCache());
return $urls;
} -
Re: Uncaught Exception: Object->__call(): the method 'subpagestocache' does not exist on 'SiteTree'

8 August 2010 at 11:18am
... $pages = DataObject::get("SiteTree", "ClassName != 'UserDefinedForm'");
Will probably need to make it get the 'Page' objects not the 'SiteTree' objects so it calls that function on Page.php and not SiteTree.php.
-
Re: Uncaught Exception: Object->__call(): the method 'subpagestocache' does not exist on 'SiteTree'

8 August 2010 at 12:49pm
I will give that a try. Whats odd, is that I have another site that I used the same code on and it works fine!
John -
Re: Uncaught Exception: Object->__call(): the method 'subpagestocache' does not exist on 'SiteTree'

21 September 2010 at 6:55am Last edited: 21 September 2010 7:07am
I also got this error (using 2.4.1). switching to 'page' from 'sitetree' works.
| 1051 Views | ||
|
Page:
1
|
Go to Top |



