DbObject: allow to set loaded properties

This commit is contained in:
Thomas Gelf 2021-10-05 23:27:36 +02:00
parent 2994403aa8
commit 8ec56ff16e
1 changed files with 10 additions and 0 deletions

View File

@ -747,6 +747,16 @@ abstract class DbObject
$this->modifiedProperties = [];
}
public function setLoadedProperty($key, $value)
{
if ($this->hasBeenLoadedFromDb()) {
$this->set($key, $value);
$this->loadedProperties[$key] = $this->get($key);
} else {
throw new RuntimeException('Cannot set loaded property for new object');
}
}
public function getOriginalProperties()
{
return $this->loadedProperties;