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; $origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true); Subsite::disable_subsite_filter(true);
$candidatePage = DataObject::get_one( $candidatePage = SiteTree::get()->filter([
SiteTree::class, 'URLSegment' => urldecode($rest),
"\"URLSegment\" = '" 'SubsiteID' => $subsiteID,
. Convert::raw2sql(urldecode($rest)) ])->first();
. "' AND \"SubsiteID\" = "
. $subsiteID,
false
);
Subsite::disable_subsite_filter($origDisableSubsiteFilter); Subsite::disable_subsite_filter($origDisableSubsiteFilter);
if ($candidatePage) { if ($candidatePage) {