From b624eb98f1d1ff36811a3294ad29b31a50683d60 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Tue, 17 Nov 2015 16:11:01 +0000 Subject: [PATCH] FIX: Setting target for unwritten VirtualPage breaks write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The VirtualPage inherits the ID of the target page, which is undesirable if the VirtualPage hasn’t been written yet - it will trick write() into thinking that the record already exists in the database --- code/model/VirtualPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/VirtualPage.php b/code/model/VirtualPage.php index d456e738..89d1510f 100644 --- a/code/model/VirtualPage.php +++ b/code/model/VirtualPage.php @@ -413,7 +413,7 @@ class VirtualPage extends Page { public function __get($field) { if(parent::hasMethod($funcName = "get$field")) { return $this->$funcName(); - } else if(parent::hasField($field)) { + } else if(parent::hasField($field) || ($field === 'ID' && !$this->exists())) { return $this->getField($field); } else { return $this->copyContentFrom()->$field;