Call to a member function getComponent() on null

Created on 14 November 2021, about 3 years ago
Updated 22 August 2023, about 1 year ago

Problem/Motivation

When using bulk tagging functionality for powertagging module the batch process stops with fatal error and the process stops.

Error: Call to a member function getComponent() on null in Drupal\powertagging\PowerTagging->extract() (line 111 of /usr/share/nginx/html/web/modules/contrib/powertagging/src/PowerTagging.php)

#0 /usr/share/nginx/html/web/modules/contrib/powertagging/src/PowerTagging.php(495): Drupal\powertagging\PowerTagging->extract('Kwanza Estates ...', Array, Array, Array)
#1 /usr/share/nginx/html/web/modules/contrib/powertagging/src/PowerTagging.php(452): Drupal\powertagging\PowerTagging->extractTagsOfEntity(Object(Drupal\node\Entity\Node), Array)
#2 /usr/share/nginx/html/web/modules/contrib/powertagging/src/Form/PowerTaggingTagContentForm.php(343): Drupal\powertagging\PowerTagging->tagEntities(Array, 'field_leo_tags', Array, Array)
#3 /usr/share/nginx/html/web/core/includes/batch.inc(295): Drupal\powertagging\Form\PowerTaggingTagContentForm->tagContentBatchProcess(Array, 'node', 'field_leo_tags', Array, Array, Array)
#4 /usr/share/nginx/html/web/core/includes/batch.inc(137): _batch_process()
#5 /usr/share/nginx/html/web/core/includes/batch.inc(93): _batch_do()
#6 /usr/share/nginx/html/web/core/modules/system/src/Controller/BatchController.php(55): _batch_page(Object(Symfony\Component\HttpFoundation\Request))
#7 [internal function]: Drupal\system\Controller\BatchController->batchPage(Object(Symfony\Component\HttpFoundation\Request))
#8 /usr/share/nginx/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#9 /usr/share/nginx/html/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /usr/share/nginx/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))

Steps to reproduce

Use the automatic tagging process on various content.

Proposed resolution

In general this process should skip errors (like this and other related to extractor, timeouts etc) and continue because there is no command line or other mean to tag content leading to require constant human supervision to restart the tagging batch process.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇷🇴Romania cristiroma

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India dineshkumarbollu

    For this add condition on line 111 at /src/PowerTagging.php

    if ($form_display !== null) {
        $specific_widget_type = $form_display->getComponent($field_definition->getName());
    }

    But need to think on else condition.

  • First commit to issue fork.
  • @elber opened merge request.
  • Status changed to Needs review about 1 year ago
  • First commit to issue fork.
Production build 0.71.5 2024