Error: Call to a member function getConfigDependencyKey() on null and Call to a member function getCacheTags() on null

Created on 7 July 2023, over 1 year ago
Updated 8 July 2023, over 1 year ago

Problem/Motivation

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getConfigDependencyKey() on null in Drupal\entityqueue\Plugin\views\relationship\EntityQueueRelationship->calculateDependencies() (line 114 of modules/contrib/entityqueue/src/Plugin/views/relationship/EntityQueueRelationship.php).
Drupal\entityqueue\Plugin\views\relationship\EntityQueueRelationship->calculateDependencies() (Line: 71)
Drupal\views\Plugin\views\display\DisplayPluginBase->getPluginDependencies(Object) (Line: 89)
Drupal\views\Plugin\views\display\DisplayPluginBase->calculatePluginDependencies(Object, 6)
array_walk(Array, Array) (Line: 959)
Drupal\views\Plugin\views\display\DisplayPluginBase->calculateDependencies() (Line: 71)
Drupal\Core\Config\Entity\ConfigEntityBase->getPluginDependencies(Object) (Line: 89)
Drupal\Core\Config\Entity\ConfigEntityBase->calculatePluginDependencies(Object) (Line: 282)
Drupal\views\Entity\View->calculateDependencies() (Line: 320)
Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object) (Line: 292)
Drupal\views\Entity\View->preSave(Object) (Line: 562)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 517)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 253)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 608)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 1001)
Drupal\views_ui\ViewUI->save() (Line: 337)
Drupal\views_ui\ViewEditForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('view_edit_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 230)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, 'alumni_stories')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
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: 169)
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: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19) 

and

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getCacheTags() on null in Drupal\entityqueue\Plugin\views\relationship\EntityQueueRelationship->getCacheTags() (line 136 of modules/contrib/entityqueue/src/Plugin/views/relationship/EntityQueueRelationship.php).
Drupal\entityqueue\Plugin\views\relationship\EntityQueueRelationship->getCacheTags() (Line: 172)
Drupal\Core\Cache\CacheableMetadata::createFromObject(Object) (Line: 2350)
Drupal\views\Plugin\views\display\DisplayPluginBase->calculateCacheMetadata() (Line: 330)
Drupal\views\Entity\View->addCacheMetadata() (Line: 304)
Drupal\views\Entity\View->preSave(Object) (Line: 562)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 517)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 253)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 608)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 1001)
Drupal\views_ui\ViewUI->save() (Line: 337)
Drupal\views_ui\ViewEditForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('view_edit_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 230)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, 'alumni_stories')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
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: 169)
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: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

after upgrading my site from Drupal 8 to 9 I'm facing the following errors when I try to save a view related to entityqueue

Proposed resolution

adding if condition to /entityqueue/src/Plugin/views/relationship/EntityQueueRelationship.php like other modules that faced the same problem

      if ($queue ) {
        $dependencies[$queue->getConfigDependencyKey()][] = $queue->getConfigDependencyName();
      }

and

      if ($queue) {
        $tags = $queue->getCacheTags();
      }
🐛 Bug report
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇯🇴Jordan Ahmad Khader

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

Comments & Activities

  • Issue created by @Ahmad Khader
  • 🇯🇴Jordan Ahmad Khader

    adding if condition to /entityqueue/src/Plugin/views/relationship/EntityQueueRelationship.php like other modules that faced the same problem

    if ($queue ) {
    $dependencies[$queue->getConfigDependencyKey()][] = $queue->getConfigDependencyName();
    }
    and

    if ($queue) {
    $tags = $queue->getCacheTags();
    }

  • Status changed to Closed: works as designed over 1 year ago
  • 🇷🇴Romania amateescu

    The actual problem here is that the queue configured in the views relationship doesn't exist anymore, and I think the error is more helpful in that regard because it lets you know that you need to fix the relationship. If we commit the patch and fail silently, the behavior of that view might be broken and there would be no easy indication of that.

  • 🇯🇴Jordan Ahmad Khader

    thanks for your comment,
    after a little investigation of what causing the issue, I found that the default display
    {

    default:
        id: default
        display_title: Master

    }
    is causing the error, although the problem is that the default display doesn't even exist on the UI view but it exists on yml view config
    I don't know if this issue is caused by views itself or entitiyqueue module!
    so I think there has to be a better way to handle this issue than view breaks entirely as the default view (that doesn't exist) shouldn't affect other view's performance

  • 🇷🇴Romania amateescu

    the problem is that the default display doesn't even exist on the UI

    This can be configured in the Views settings (/admin/structure/views/settings -> Always show the default display), the default display can be either hidden or shown based on that configuration.

    The problem is not caused by neither Views or Entityqueue, it is simply a user configuration error and I think the current error being thrown is helpful for the site admin, making them aware there's a problem that needs to be fixed.

  • 🇯🇴Jordan Ahmad Khader

    understandable, I see what you mean thanks for your replies

Production build 0.71.5 2024