You are here

protected function LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage in Lingotek Translation 3.2.x

Same name and namespace in other branches
  1. 8 src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  2. 8.2 src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  3. 4.0.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  4. 3.0.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  5. 3.1.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  6. 3.3.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  7. 3.4.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  8. 3.5.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  9. 3.6.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  10. 3.7.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
  11. 3.8.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()

Extract the problematic table from the previous exception message.

@returns A string with the problematic table name.

Parameters

\Exception $previous:

1 call to LingotekContentEntityStorageException::extractTableFromPreviousExceptionMessage()
LingotekContentEntityStorageException::__construct in src/Exception/LingotekContentEntityStorageException.php

File

src/Exception/LingotekContentEntityStorageException.php, line 48

Class

LingotekContentEntityStorageException
An exception for issues when storing content entity translations.

Namespace

Drupal\lingotek\Exception

Code

protected function extractTableFromPreviousExceptionMessage(\Exception $previous = NULL) {
  $table = '';
  if ($previous !== NULL) {

    // Previous message would be like:
    //    "Data too long for column 'name' at row 2"
    $previous_message = $previous
      ->getMessage();
    $strings = explode("'", $previous_message);
    $table = count($strings) > 1 ? $strings[1] : '';
  }
  return $table;
}