mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
BUGFIX: tables and columns quoted properly
This commit is contained in:
parent
40170aac62
commit
06bb7c7423
@ -228,15 +228,15 @@ class SiteTreeSubsites extends SiteTreeDecorator {
|
||||
return DataObject::get('RelatedPageLink', "\"RelatedPageLink\".\"RelatedPageID\" = {$this->owner->ID}
|
||||
AND R2.\"ID\" IS NULL", '',
|
||||
"INNER JOIN \"SiteTree\" ON \"SiteTree\".\"ID\" = \"RelatedPageLink\".\"MasterPageID\"
|
||||
LEFT JOIN \"RelatedPageLink\" AS R2 ON R2.MasterPageID = {$this->owner->ID}
|
||||
AND R2.RelatedPageID = RelatedPageLink.MasterPageID
|
||||
LEFT JOIN \"RelatedPageLink\" AS R2 ON R2.\"MasterPageID\" = {$this->owner->ID}
|
||||
AND R2.\"RelatedPageID\" = \"RelatedPageLink\".\"MasterPageID\"
|
||||
"
|
||||
);
|
||||
}
|
||||
|
||||
function NormalRelated() {
|
||||
$return = new DataObjectSet();
|
||||
$links = DataObject::get('RelatedPageLink', 'MasterPageID = ' . $this->owner->ID);
|
||||
$links = DataObject::get('RelatedPageLink', '"MasterPageID" = ' . $this->owner->ID);
|
||||
if($links) foreach($links as $link) {
|
||||
if($link->RelatedPage()->exists()) {
|
||||
$return->push($link->RelatedPage());
|
||||
@ -248,7 +248,7 @@ class SiteTreeSubsites extends SiteTreeDecorator {
|
||||
|
||||
function alternateSiteConfig() {
|
||||
if(!$this->owner->SubsiteID) return false;
|
||||
$sc = DataObject::get_one('SiteConfig', 'SubsiteID = ' . $this->owner->SubsiteID);
|
||||
$sc = DataObject::get_one('SiteConfig', '"SubsiteID" = ' . $this->owner->SubsiteID);
|
||||
if(!$sc) {
|
||||
$sc = new SiteConfig();
|
||||
$sc->SubsiteID = $this->owner->SubsiteID;
|
||||
|
@ -430,7 +430,7 @@ JS;
|
||||
|
||||
$rolesSubsites = DataObject::get(
|
||||
'Subsite',
|
||||
"\"Subsite\".Title != ''",
|
||||
"\"Subsite\".\"Title\" != ''",
|
||||
'',
|
||||
"LEFT JOIN \"Group_Subsites\"
|
||||
ON \"Group_Subsites\".\"SubsiteID\" = \"Subsite\".\"ID\"
|
||||
|
@ -139,7 +139,7 @@ class SubsiteTest extends SapphireTest {
|
||||
$subsite2 = $subsite1->duplicate();
|
||||
$subsite2->activate();
|
||||
// change content on dupe
|
||||
$page2 = DataObject::get_one('Page', "Title = 'MyAwesomePage'");
|
||||
$page2 = DataObject::get_one('Page', "\"Title\" = 'MyAwesomePage'");
|
||||
$page2->Title = 'MyNewAwesomePage';
|
||||
$page2->write();
|
||||
$page2->doPublish();
|
||||
|
@ -177,12 +177,12 @@ class SubsitesVirtualPageTest extends SapphireTest {
|
||||
$page->doUnpublish();
|
||||
|
||||
Subsite::changeSubsite($vp1->SubsiteID);
|
||||
$onLive = Versioned::get_one_by_stage('SubsitesVirtualPage', 'Live', "SiteTree_Live.ID = ".$vp1->ID);
|
||||
$onLive = Versioned::get_one_by_stage('SubsitesVirtualPage', 'Live', "\"SiteTree_Live\".\"ID\" = ".$vp1->ID);
|
||||
$this->assertFalse($onLive, 'SVP has been removed from live');
|
||||
|
||||
$subsite = $this->objFromFixture('Subsite_Template', 'subsite2');
|
||||
Subsite::changeSubsite($vp2->SubsiteID);
|
||||
$onLive = Versioned::get_one_by_stage('SubsitesVirtualPage', 'Live', "SiteTree_Live.ID = ".$vp2->ID);
|
||||
$onLive = Versioned::get_one_by_stage('SubsitesVirtualPage', 'Live', "\"SiteTree_Live\".\"ID\" = ".$vp2->ID);
|
||||
$this->assertFalse($onLive, 'SVP has been removed from live');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user