Skip to content

Commit

Permalink
Merge branch '3.0' into 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ScopeyNZ committed Sep 17, 2018
2 parents 0ad6e11 + c6e68e5 commit 265b948
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Models/BaseElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function getCMSFields()
}

// Support for new history viewer in SS 4.2+
if (class_exists(HistoryViewerField::class)) {
if ($this->isInDB() && class_exists(HistoryViewerField::class)) {
Requirements::javascript('dnadesign/silverstripe-elemental:client/dist/js/bundle.js');

$historyViewer = HistoryViewerField::create('ElementHistory');
Expand Down
4 changes: 2 additions & 2 deletions src/Models/ElementalArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function getOwnerPage()
$areaID = $eaRelationship . 'ID';

$currentStage = Versioned::get_stage() ?: Versioned::DRAFT;
$page = Versioned::get_one_by_stage($class, $currentStage, "\"$areaID\" = {$this->ID}");
$page = Versioned::get_by_stage($class, $currentStage)->filter($areaID, $this->ID)->first();

if ($page) {
$this->cacheData['owner_page'] = $page;
Expand All @@ -185,7 +185,7 @@ public function getOwnerPage()

foreach ($elementalAreaRelations as $eaRelationship) {
$areaID = $eaRelationship . 'ID';
$page = Versioned::get_one_by_stage($class, Versioned::DRAFT, "\"$areaID\" = {$this->ID}");
$page = Versioned::get_by_stage($class, Versioned::DRAFT)->filter($areaID, $this->ID)->first();

if ($page) {
if ($this->OwnerClassName !== $class) {
Expand Down

0 comments on commit 265b948

Please sign in to comment.