Skip to content
Snippets Groups Projects
Commit a409b2bd authored by Shibin Das's avatar Shibin Das
Browse files

fix: Avoid crashing the site when trying to delete a translation

parent 8c4a1c5c
No related branches found
No related tags found
No related merge requests found
......@@ -62,13 +62,20 @@ class RevisionGraphStorage {
$branch = $parent_version_id;
}
$this->connection->insert('revision_graph')->fields([
'primary_id' => $entity->id(),
'version_id' => $entity->getRevisionId(),
'parent_version_id' => $parent_version_id,
'type' => $entity->getEntityTypeId(),
'branch' => $this->formatBranchName($branch, $entity->language()->getId()),
])->execute();
$result = $this->connection->query("SELECT * FROM {revision_graph} WHERE primary_id = :primary_id AND version_id = :version_id AND type = :type", [
':primary_id' => $entity->id(),
':version_id' => $entity->getRevisionId(),
':type' => $entity->getEntityTypeId(),
])->fetchAll();
if (empty($result)) {
$this->connection->insert('revision_graph')->fields([
'primary_id' => $entity->id(),
'version_id' => $entity->getRevisionId(),
'parent_version_id' => $parent_version_id,
'type' => $entity->getEntityTypeId(),
'branch' => $this->formatBranchName($branch, $entity->language()->getId()),
])->execute();
}
}
protected function formatBranchName($parent_branch, $language_id): string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment