Fixed BacklinkTracking filter usage

Previous deprecation fixes made this method error out
when called on the root node (ID=0), so when admin/assets is first called.
This commit is contained in:
Ingo Schommer 2015-04-28 23:34:26 +12:00
parent 812a921072
commit 94d354de4a

View File

@ -72,10 +72,13 @@ class SiteTreeFileExtension extends DataExtension {
Please manipluate the returned list directly.', Deprecation::SCOPE_GLOBAL);
}
$links = $this->owner->getManyManyComponents('BackLinkTracking')
->where($filter)
->sort($sort)
->limit($limit);
$links = $this->owner->getManyManyComponents('BackLinkTracking');
if($this->owner->ID) {
$links = $links
->where($filter)
->sort($sort)
->limit($limit);
}
$this->owner->extend('updateBackLinkTracking', $links);
if(class_exists("Subsite")){