mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX Don't set SubsiteID from DataObject::context_obj() if its NULL in SiteTreeSubsites->augmentSQL()
This commit is contained in:
parent
79bedca43b
commit
f6706c16ed
@ -57,7 +57,8 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
// If you're querying by ID, ignore the sub-site - this is a bit ugly...
|
||||
if(!$query->where || (strpos($query->where[0], ".\"ID\" = ") === false && strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false && strpos($query->where[0], "ID = ") !== 0)) {
|
||||
|
||||
if($context = DataObject::context_obj()) $subsiteID = (int) $context->SubsiteID;
|
||||
$context = DataObject::context_obj();
|
||||
if($context && is_numeric($context->SubsiteID)) $subsiteID = (int) $context->SubsiteID;
|
||||
else $subsiteID = (int) Subsite::currentSubsiteID();
|
||||
|
||||
// The foreach is an ugly way of getting the first key :-)
|
||||
|
Loading…
Reference in New Issue
Block a user