BranchMerger: trigger activity log entry when...

...deleting an object
This commit is contained in:
Thomas Gelf 2022-02-08 08:27:53 +01:00
parent 3590f725eb
commit 9611381956
2 changed files with 3 additions and 7 deletions

View File

@ -149,17 +149,13 @@ class BranchActivity
return $object;
}
public function deleteDbObject(Db $connection)
public function deleteDbObject(DbObject $object)
{
if (!$this->isActionDelete()) {
throw new RuntimeException('Only BranchActivity instances with action=delete can delete objects');
}
$db = $connection->getDbAdapter();
return $db->delete($this->getObjectTable(), $db->quoteInto(
'uuid = ?',
$connection->quoteBinary($this->getObjectUuid()->getBytes())
));
return $object->delete();
}
public static function load($ts, Db $connection)

View File

@ -121,7 +121,7 @@ class BranchMerger
}
} elseif ($activity->isActionDelete()) {
if ($exists) {
$activity->deleteDbObject($this->connection);
$activity->deleteDbObject($class::requireWithUniqueId($uuid, $this->connection));
} elseif (! $this->ignoreDeleteWhenMissing && ! $this->ignoresActivity($activity)) {
throw new MergeErrorDeleteMissingObject($activity);
}