1

How can I tell which entity is throwing this error (on all pages)?

TypeError: Argument 4 passed to Drupal\views\Plugin\views\display\Block::__construct() must implement interface Drupal\Core\Entity\EntityManagerInterface, instance of Drupal\Core\Entity\EntityTypeManager given, called in /usr/local/var/www/hifldlive/web/modules/contrib/ctools/modules/ctools_views/src/Plugin/Display/Block.php on line 54 in Drupal\views\Plugin\views\display\Block->__construct() (line 69 of core/modules/views/src/Plugin/views/display/Block.php).

I have run composer update on an un-familiar site.
Composer update, drush updb and drush cr all run without errors.
There are about 20 migration tables generated.

I'm guessing I need to roll back the composer update (since it trashes the site), fix the data, then re-run the composer update.
I stuck on how to identify what to fix.
It is no problem to roll back.

I can't where entities are stored in the database. I also don't see entities in the admin pages.

I can use Drupal Entity API in a custom module, but the site won't load on any page.

1
  • 1
    This is not a problem with entities stored in the database. You have outdated core/module code, either core or ctools is much older than the other.
    – 4uk4
    Apr 27, 2020 at 21:36

1 Answer 1

2

This is not a problem with entities stored in the database, it is is a version conflict between the module Ctools and Drupal core.

When you install the current version of Ctools with composer require 'drupal/ctools:^3.4' you see that __construct() is calling the parent constructor providing a parameter EntityTypeManagerInterface.

modules/contrib/ctools/modules/ctools_views/src/Plugin/Display/Block.php

  /**
   * Constructs a new Block instance.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity manager.
   * @param \Drupal\Core\Block\BlockManagerInterface $block_manager
   *   The block manager.
   * @param \Drupal\views\Plugin\ViewsHandlerManager $filter_manager
   *   The views filter plugin manager.
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The current request.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, BlockManagerInterface $block_manager, ViewsHandlerManager $filter_manager, Request $request) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $block_manager);

    $this->filterManager = $filter_manager;
    $this->request = $request;
  }

This requires that your core version has this code change:

https://git.drupalcode.org/project/drupal/-/commit/12d7ed53087a469ef8f87476c2849f7b24bfbbb7#140e79af0797f7f25fd1f20e2ebc697be118fea6

So you have to make sure you are using a current core version 8.8.x or you have to downgrade Ctools to a version not having this change.

1
  • Thank you very much for the exact answer. Changed composer.json to "drupal/ctools": "3.2", without the ^, ran composer update, and all is well. Apr 28, 2020 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.