Merge pull request #451 from cjsewell/2

Fix "Column 'URLSegment' in where clause is ambiguous" when duplicating pages
This commit is contained in:
Dylan Wagstaff 2020-01-22 09:01:17 +13:00 committed by GitHub
commit fd10b868ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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) {