Error: Call to a member function getConfigDependencyName() on null

Created on 28 June 2019, over 5 years ago
Updated 19 October 2023, about 1 year ago

Problem/Motivation

Steps to reproduce:

  1. A fresh installation of Drupal 8.8.x
  2. Install 8.x-1.x version of this module (commit: 9c861dd4452a28b8312674e89292a41fb4652d66 as writing)
  3. Export config drush cex
  4. Get site UUID, drush cget system.site uuid
  5. Install again
  6. Set site UUID drush cset system.site uuid THE-UUID-GOT-AT-STEP-4
  7. Delete shortcut entities so that it's possible to import the config exported at step 3. drush edel shortcut
  8. Import config, drush cim -y
  9. Bingo
    Import the listed configuration changes? (yes/no) [yes]:
     > yes
    
     [notice] Synchronized extensions: install embed.
     [notice] Synchronized extensions: install entity_browser.
     [notice] Synchronized extensions: install entity_embed.
    Error: Call to a member function getConfigDependencyName() on null in Drupal\Core\Entity\EntityDisplayBase->calculateDependencies() (line 325 of /Users/jungleran/www/8.8.x/core/lib/Drupal/Core/Entity/EntityDisplayBase.php).
     [warning] Drush command terminated abnormally. Check for an exit() in your Drupal site.

Furthermore:

  1. Apply the patch mentioned in #6, 📌 calculateDependencies doesn't check $mode_entity if it is NULL Needs work , but the latest one, in #28

    curl https://www.drupal.org/files/issues/2019-12-16/2741429-2-28.patch | git apply 
    

    Repeat the steps above, run twice drush cim,

    The first time you will get the error

     // Import the listed configuration changes?: yes.                                                                      
    
     [notice] Synchronized extensions: install embed.
     [notice] Synchronized extensions: install entity_browser.
     [notice] Synchronized extensions: install entity_embed.
    
    In ConfigImportCommands.php line 261:
                                                       
      The import failed due to the following reasons:  
    
    config:import [--preview [PREVIEW]] [--source SOURCE] [--partial] [--diff] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--notify] [--druplicon] [--xh-link XH-LINK] [--] <command> [<label>]
                                                       
    

    No clues.

  2. But visit /admin/reports/dblog, you will see a config_import type message below:
    
    Drupal\Core\Config\Entity\Exception\ConfigEntityDependencyDoesNotExistException: Cannot add the config entity dependency with ID 'node.content_browser' of type 'entity_view_mode' to core.entity_view_display.node.article.content_browser as it does not exist in Drupal\Core\Config\Entity\ConfigEntityBase->addConfigEntityDependency() (line 645 of /Users/jungleran/www/8.8.x/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇨🇳China jungle Chongqing, China

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.

Production build 0.71.5 2024