mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
DbObject: improve "hasBeenModified" logic
This commit is contained in:
parent
2196426ff5
commit
82269775f4
@ -371,9 +371,27 @@ abstract class DbObject
|
||||
if ($value === $this->properties[$key]) {
|
||||
return $this;
|
||||
}
|
||||
if ($key === 'id' || substr($key, -3) === '_id') {
|
||||
if ((int) $value === (int) $this->properties[$key]) {
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->hasBeenLoadedFromDb()) {
|
||||
if ($value === $this->loadedProperties[$key]) {
|
||||
unset($this->modifiedProperties[$key]);
|
||||
if (empty($this->modifiedProperties)) {
|
||||
$this->hasBeenModified = false;
|
||||
}
|
||||
} else {
|
||||
$this->hasBeenModified = true;
|
||||
$this->modifiedProperties[$key] = true;
|
||||
}
|
||||
} else {
|
||||
$this->hasBeenModified = true;
|
||||
$this->modifiedProperties[$key] = true;
|
||||
}
|
||||
|
||||
$this->hasBeenModified = true;
|
||||
$this->modifiedProperties[$key] = true;
|
||||
$this->properties[$key] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user