FIX: Setting target for unwritten VirtualPage breaks write

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
This commit is contained in:
Loz Calver 2015-11-17 16:11:01 +00:00
parent 2983d823d1
commit b624eb98f1

View File

@ -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;