Cannot delete content when the document is not found in the TMS

Created on 6 June 2025, 1 day ago

Problem/Motivation

I am unable to delete content if a document is not found in the TMS. When an entity is deleted, an attempt
to cancel the document in the TMS is made
. If the document is not found in the TMS, a LingotekDocumentNotFoundException is thrown, which is not caught in lingotek_entity_delete(). The result is that the entity cannot be deleted because this error occurs:

Drupal\Core\Entity\EntityStorageException: Document [document_id] not found. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (line 763 of /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Steps to reproduce

  1. In Drupal, complete a translation through Lingotek.
  2. In the TMS, delete the document.
  3. In Drupal, attempt to delete the entity.

The issue can also occur if different Lingotek projects are used across different environments. For example, for our local/dev environments, we use a different Lingotek project, workflow, and vault. Pulling databases from production can result in a document not existing in the current Lingotek project.

Proposed resolution

In lingotek_entity_delete(), catch the LingotekDocumentNotFoundException and log a warning to the logs. If there is no document found in the TMS, we should be able to delete the Drupal entity safely.

πŸ› Bug report
Status

Active

Version

4.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mtalt Maryland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024