public function LingotekCliService::getEntity in Lingotek Translation 3.0.x
Same name and namespace in other branches
- 8.2 src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 4.0.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 3.1.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 3.2.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 3.3.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 3.4.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 3.5.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 3.6.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 3.7.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
- 3.8.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::getEntity()
5 calls to LingotekCliService::getEntity()
- LingotekCliService::checkTranslationsStatuses in src/
Cli/ LingotekCliService.php - LingotekCliService::checkUpload in src/
Cli/ LingotekCliService.php - LingotekCliService::downloadTranslations in src/
Cli/ LingotekCliService.php - LingotekCliService::requestTranslations in src/
Cli/ LingotekCliService.php - LingotekCliService::upload in src/
Cli/ LingotekCliService.php
File
- src/
Cli/ LingotekCliService.php, line 183
Class
Namespace
Drupal\lingotek\CliCode
public function getEntity($entity_type_id, $entity_id) {
$entity_storage = NULL;
if (!$this->entityTypeManager
->hasDefinition($entity_type_id) || !($entity_storage = $this->entityTypeManager
->getStorage($entity_type_id))) {
$this->logger
->error($this
->t('Invalid entity type id: @entity_type_id', [
'@entity_type_id' => $entity_type_id,
]));
return self::COMMAND_ERROR_ENTITY_TYPE_ID;
}
/** @var \Drupal\Core\Entity\EntityInterface $entity */
$entity = $entity_storage
->load($entity_id);
if (!$entity) {
$this->logger
->error($this
->t('Entity of type @entity_type_id with id @entity_id not found.', [
'@entity_type_id' => $entity_type_id,
'@entity_id' => $entity_id,
]));
return self::COMMAND_ERROR_ENTITY_NOT_FOUND;
}
return $entity;
}