Error on /admin/localization/translation-history page

Not sure if it's my database which is in a weird state but it wouldn't hurt to check for the field value in that method.
\Drupal\l10n_server\Entity\L10nServerTranslationHistory::getActionUid

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getValue() on null in Drupal\l10n_server\Entity\L10nServerTranslationHistory->getActionUid() (line 230 of modules/contrib/l10n_server/l10n_server/src/Entity/L10nServerTranslationHistory.php).

Drupal\l10n_server\Entity\L10nServerTranslationHistory->getActionUid() (Line: 48)
Drupal\l10n_server\Entity\ListBuilder\L10nServerTranslationHistoryListBuilder->buildRow(Object) (Line: 219)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 18)
Drupal\l10n_server\Entity\ListBuilder\L10nServerTranslationHistoryListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing('l10n_server_translation_history')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 159)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

Radelson created an issue. See original summary.

sutharsan’s picture

Status: Active » Needs review
StatusFileSize
new1.58 KB

All getters of the L10nServerTranslationHistory entity have the same potential problem. This patch fixes them in the same manner.

sutharsan’s picture

The fault can happen on all entity properties that have NULL as default value and have the same code construction in the getter:
$this->get('foo')->first()->getValue()['value'];

  • FMB committed 1ce874f0 on 3.0.x authored by Sutharsan
    Issue #3311405 by Sutharsan, Radelson: Error on translation-history...
fmb’s picture

Status: Needs review » Fixed

Thanks for your help @Sutharsan, much appreciated!

sutharsan’s picture

Status: Fixed » Needs review
Related issues: +#3347271: Prevent error on entity getters

I've created a follow-up for the remaining entities: #3347271: Prevent error on entity getters

sutharsan’s picture

fmb’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.