mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Fixed array_key_exists check in DataObject->setField that was failing when DataObject->record was not yet initialised by DataObject->setField.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63813 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
431afe234f
commit
9f0718f6df
@ -1732,13 +1732,13 @@ class DataObject extends ViewableData implements DataObjectInterface {
|
||||
} else {
|
||||
$defaults = $this->stat('defaults');
|
||||
// if a field is not existing or has strictly changed
|
||||
if(!array_key_exists($fieldName, $this->record) || $this->record[$fieldName] !== $val) {
|
||||
if(!isset($this->record[$fieldName]) || $this->record[$fieldName] !== $val) {
|
||||
// TODO Add check for php-level defaults which are not set in the db
|
||||
// TODO Add check for hidden input-fields (readonly) which are not set in the db
|
||||
// At the very least, the type has changed
|
||||
$this->changed[$fieldName] = 1;
|
||||
|
||||
if(!array_key_exists($fieldName, $this->record) || $this->record[$fieldName] != $val) {
|
||||
if(!isset($this->record[$fieldName]) || $this->record[$fieldName] != $val) {
|
||||
// Value has changed as well, not just the type
|
||||
$this->changed[$fieldName] = 2;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user