Fix "Column 'URLSegment' in where clause is ambiguous" when duplicating pages

This commit is contained in:
Corey Sewell 2020-01-09 13:14:07 +13:00 committed by Corey Sewell
parent 831c3c3cbe
commit f1fce6f739

View File

@ -484,14 +484,10 @@ class SiteTreeSubsites extends DataExtension
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true);
$candidatePage = DataObject::get_one(
SiteTree::class,
"\"URLSegment\" = '"
. Convert::raw2sql(urldecode($rest))
. "' AND \"SubsiteID\" = "
. $subsiteID,
false
);
$candidatePage = SiteTree::get()->filter([
'URLSegment' => urldecode($rest),
'SubsiteID' => $subsiteID,
])->first();
Subsite::disable_subsite_filter($origDisableSubsiteFilter);
if ($candidatePage) {