class LingotekContentEntityStorageException in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8 src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 8.2 src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.0.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.1.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.2.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.3.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.4.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.5.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.6.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.7.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 3.8.x src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
An exception for issues when storing content entity translations.
@package Drupal\lingotek\Exception
Hierarchy
- class \Drupal\lingotek\Exception\LingotekException extends \Drupal\lingotek\Exception\Exception
- class \Drupal\lingotek\Exception\LingotekContentEntityStorageException
Expanded class hierarchy of LingotekContentEntityStorageException
5 files declare their use of LingotekContentEntityStorageException
- DownloadAllTranslationsFromLingotekAction.php in src/
Plugin/ Action/ DownloadAllTranslationsFromLingotekAction.php - LingotekContentTranslationService.php in src/
LingotekContentTranslationService.php - LingotekEntityController.php in src/
Controller/ LingotekEntityController.php - LingotekInterfaceTranslationService.php in src/
LingotekInterfaceTranslationService.php - LingotekManagementFormBase.php in src/
Form/ LingotekManagementFormBase.php
File
- src/
Exception/ LingotekContentEntityStorageException.php, line 12
Namespace
Drupal\lingotek\ExceptionView source
class LingotekContentEntityStorageException extends LingotekException {
/**
* The entity that could not be saved.
*
* @var \Drupal\Core\Entity\ContentEntityInterface
*/
protected $entity;
/**
* @var string
*/
protected $table;
public function __construct(ContentEntityInterface $entity, \Exception $previous = NULL, $message = NULL, $code = 0) {
parent::__construct($message, $code, $previous);
$this->entity = $entity;
$this->table = $this
->extractTableFromPreviousExceptionMessage($previous);
$this->code = $previous !== NULL ? $previous
->getCode() : $code;
}
/**
* Gets the table name that failed to update.
*/
public function getTable() {
return $this->table;
}
/**
* Extract the problematic table from the previous exception message.
*
* @param \Exception $previous
*
* @returns
* A string with the problematic table name.
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LingotekContentEntityStorageException:: |
protected | property | The entity that could not be saved. | |
LingotekContentEntityStorageException:: |
protected | property | ||
LingotekContentEntityStorageException:: |
protected | function | Extract the problematic table from the previous exception message. | |
LingotekContentEntityStorageException:: |
public | function | Gets the table name that failed to update. | |
LingotekContentEntityStorageException:: |
public | function | 1 |