class LingotekContentEntityStorageException in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Exception/LingotekContentEntityStorageException.php \Drupal\lingotek\Exception\LingotekContentEntityStorageException
- 4.0.x 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
Hierarchy
- class \Drupal\lingotek\Exception\LingotekException extends \Drupal\lingotek\Exception\Exception
- class \Drupal\lingotek\Exception\LingotekContentEntityStorageException
Expanded class hierarchy of LingotekContentEntityStorageException
3 files declare their use of LingotekContentEntityStorageException
- LingotekContentTranslationService.php in src/
LingotekContentTranslationService.php - Contains \Drupal\lingotek\LingotekContentTranslationService.
- LingotekEntityController.php in src/
Controller/ LingotekEntityController.php - LingotekManagementForm.php in src/
Form/ LingotekManagementForm.php - Contains \Drupal\Lingotek\Form\LingotekManagementForm.
File
- src/
Exception/ LingotekContentEntityStorageException.php, line 16 - Contains \Drupal\lingotek\Exception\LingotekContentEntityStorageException.
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
->getCode();
}
/**
* 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 |