mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
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:
parent
2983d823d1
commit
b624eb98f1
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user