BUGFIX Fixed SiteTree->validURLSegment() to perform a DataObject::get_one() instead of raw SQL, in order for decorated filtering (e.g. by the subsites module) to apply correctly.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89236 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-10-16 00:31:39 +00:00
parent f792d16c01
commit 613dbf55d0

View File

@ -1436,9 +1436,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
}
}
return DB::query (
"SELECT COUNT(\"ID\") FROM \"SiteTree\" WHERE \"URLSegment\" = '$this->URLSegment' $IDFilter $parentFilter"
)->value() < 1;
$existingPage = DataObject::get_one(
'SiteTree',
"\"URLSegment\" = '$this->URLSegment' $IDFilter $parentFilter"
);
return !($existingPage);
}
/**