Allow to to disable the saving of changed or deleted data.

Also it is possible to only save the information which fields were changed, not the data in it.
This commit is contained in:
Jan Böhmer 2020-02-23 21:04:16 +01:00
parent 2bc6a2be3c
commit b5bc096972
4 changed files with 76 additions and 5 deletions

View file

@ -68,7 +68,7 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
*/
public function hasChangedFieldsInfo(): bool
{
return $this->hasOldDataInformations();
return isset($this->extra['f']) || $this->hasOldDataInformations();
}
/**
@ -77,7 +77,26 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
*/
public function getChangedFields(): array
{
return array_keys($this->getOldData());
if ($this->hasOldDataInformations()) {
return array_keys($this->getOldData());
}
if (isset($this->extra['f'])) {
return $this->extra['f'];
}
return [];
}
/**
* Set the fields that were changed during this element change.
* @param string[] $changed_fields The names of the fields that were changed during the elements
* @return $this
*/
public function setChangedFields(array $changed_fields): self
{
$this->extra['f'] = $changed_fields;
return $this;
}
/**