Skip to content

Commit

Permalink
Merge branch '3.0' into 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ScopeyNZ committed Jul 11, 2019
2 parents b19f7d5 + ce2b8eb commit 36f5af1
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Models/ElementalArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ public function ElementControllers()
return $controllers;
}

public function onBeforeWrite()
{
$this->getOwnerPage();
parent::onBeforeWrite();
}

/**
* @return null|DataObject
* @throws \Psr\Container\NotFoundExceptionInterface
Expand Down Expand Up @@ -232,10 +226,14 @@ public function getOwnerPage()
throw $ex;
}

if ($page) {
if ($page && $page->exists()) {
if ($this->OwnerClassName !== $class) {
$this->OwnerClassName = $class;
$this->write();

// Avoid recursion: only write if it's already in the database
if ($this->isInDB()) {
$this->write();
}
}

$this->cacheData['area_relation_name'] = $page;
Expand Down

0 comments on commit 36f5af1

Please # to comment.