Call to undefined method ExternalEntityStorage::getTableMapping() in Drupal\views\Entity\Render\TranslationLanguageRenderer->getLangcodeTable()

Created on 24 March 2025, about 2 months ago

Problem/Motivation

When previewing a view using the Views module, this error shows up:

Error: Call to undefined method Drupal\external_entities\ExternalEntityStorage::getTableMapping() in Drupal\views\Entity\Render\TranslationLanguageRenderer->getLangcodeTable() (line 55 of /var/www/html/core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php).

Backtrace

#0 /var/www/html/core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php(31): Drupal\views\Entity\Render\TranslationLanguageRenderer->getLangcodeTable(Object(Drupal\xntt_views\Plugin\views\query\XnttViewsQuery), NULL)
#1 /var/www/html/core/modules/views/src/Plugin/views/field/RenderedEntity.php(178): Drupal\views\Entity\Render\TranslationLanguageRenderer->query(Object(Drupal\xntt_views\Plugin\views\query\XnttViewsQuery), NULL)
#2 /var/www/html/core/modules/views/src/ViewExecutable.php(1433): Drupal\views\Plugin\views\field\RenderedEntity->query(false)
#3 /var/www/html/core/modules/views/src/ViewExecutable.php(1342): Drupal\views\ViewExecutable->_build('field')
#4 /var/www/html/core/modules/views/src/ViewExecutable.php(1451): Drupal\views\ViewExecutable->build(NULL)
#5 /var/www/html/core/modules/views/src/ViewExecutable.php(1514): Drupal\views\ViewExecutable->execute(NULL)
#6 /var/www/html/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2467): Drupal\views\ViewExecutable->render()
#7 /var/www/html/core/modules/views/src/ViewExecutable.php(1722): Drupal\views\Plugin\views\display\DisplayPluginBase->preview()
#8 /var/www/html/core/modules/views_ui/src/ViewUI.php(617): Drupal\views\ViewExecutable->preview('page_1', Array)
#9 /var/www/html/core/modules/views_ui/src/ViewPreviewForm.php(63): Drupal\views_ui\ViewUI->renderPreview('page_1', Array)
#10 /var/www/html/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\views_ui\ViewPreviewForm->form(Array, Object(Drupal\Core\Form\FormState))
#11 /var/www/html/core/modules/views_ui/src/ViewFormBase.php(42): Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#12 [internal function]: Drupal\views_ui\ViewFormBase->buildForm(Array, Object(Drupal\Core\Form\FormState), 'page_1')
#13 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array(Array, Array)
#14 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(375): Drupal\Core\Form\FormBuilder->retrieveForm('view_preview_fo...', Object(Drupal\Core\Form\FormState))
#15 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(633): Drupal\Core\Form\FormBuilder->rebuildForm('view_preview_fo...', Object(Drupal\Core\Form\FormState), Array)
#16 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('view_preview_fo...', Array, Object(Drupal\Core\Form\FormState))
#17 /var/www/html/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\views_ui\ViewPreviewForm), Object(Drupal\Core\Form\FormState))
#18 /var/www/html/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#19 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#20 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#21 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#23 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#24 /var/www/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#25 /var/www/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#26 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /var/www/html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /var/www/html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /var/www/html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#36 {main}

Steps to reproduce

  1. Enable the External Entities Views Integration (Experimental) module (xntt_views).
  2. Create and configure an external entity.
  3. Create a new View based on the created external entity.
  4. Add a field.
  5. Notice an error in the console:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /en/admin/structure/views/view/temporary_ee_view/preview/page_1 StatusText: 500 Service unavailable (with message) ResponseText: The website encountered an unexpected error. Try again later.Error: Call to undefined method Drupal\external_entities\ExternalEntityStorage::getTableMapping() in Drupal\views\Entity\Render\TranslationLanguageRenderer->getLangcodeTable() (line 55 of core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php).

View configuration

Proposed resolution

It looks like the method isn't implemented in the root module. Maybe we need to add it?

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

🐛 Bug report
Status

Active

Version

3.0

Component

Views

Created by

🇨🇦Canada colan Toronto 🇨🇦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @colan
  • 🇫🇷France guignonv Montpellier

    I think I met that problem once. It rings a bell to me. Well, right now, I'm busy on another project but I'll be able to get back on this in 1 or 2 weeks I think/hope.

  • 🇨🇦Canada colan Toronto 🇨🇦

    Thanks for offering! Will steal it from you if we need it sooner.

  • 🇨🇦Canada colan Toronto 🇨🇦

    This is now a blocker for us so I need to start working on it. Can you provide any tips, advice or steps to approach the problem to help me get moving on it? Anything you can offer would be helpful.

  • 🇨🇦Canada colan Toronto 🇨🇦

    I'm also wondering if it has anything to do with this TODO.

  • 🇫🇷France guignonv Montpellier

    What I can say is that I had a look to the views code of Search API to create the views plugin. I'm quite sure their code solves this problem in a way or another. So, my advice would be to see what they did... :p

  • 🇨🇦Canada colan Toronto 🇨🇦

    Thanks for the help.

    The first problem is that Search API extends ConfigEntityStorage, and we extend ContentEntityStorage.

    I'm going to look into whether it makes sense to implement the method, which core calls from here. It's defined at SqlEntityStorageInterface::getTableMapping(), and there's an example at SqlContentEntityStorage::getTableMapping().

  • 🇨🇦Canada colan Toronto 🇨🇦

    Playing with Views a little bit, I think the problem goes away if you don't include the full "Rendered entity" in the field list (which seems to come in by default with the wizard). That is, remove "Rendered entity" from the Fields section, and add other fields individually. Needs a bit more experimentation, but this could be a workaround.

  • 🇨🇦Canada colan Toronto 🇨🇦

    Confirmed the above with some other folks here: This is only a problem if you use the rendered entity in your field list. If you remove it and use individual fields, this doesn't come up.

    Unassigned myself as this is no longer a priority over here.

  • 🇫🇷France guignonv Montpellier

    @guignonv: Maybe this is why you're not running into it?

    Yes that might be why because I rarely use full renderded entity. But now, I could try to reproduce the problem later to fix it.

Production build 0.71.5 2024