WebformSubmissionViewsData not working for me

Created on 13 August 2024, 8 months ago
Updated 15 August 2024, 8 months ago

/drush cr
PHP Fatal error: Uncaught TypeError: Drupal\webform_views\WebformSubmissionViewsData::__construct(): Argument #7 ($entity_type_bundle_info) must be of type Drupal\webform_views\EntityTypeBundleInfoInterface, Drupal\Core\Entity\EneBundleInfo given, called in modules/contrib/webform_views/src/WebformSubmissionViewsData.php on line 47 and defined in modules/contrib/webform_views/src/WebformSubmissionViewsData.p

This is the new updated code of WebformSubmissionViewsData.php in /src/ which fixed the critical error.


namespace Drupal\webform_views;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityTypeBundleInfo;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Sql\SqlEntityStorageInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\webform\Plugin\WebformElementManagerInterface;
use Drupal\webform\WebformInterface;
use Drupal\webform\WebformSubmissionViewsData as WebformSubmissionViewsDataBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Views data for 'webform_submission' entity type.
 */
class WebformSubmissionViewsData extends WebformSubmissionViewsDataBase {

  /**
   * @var WebformElementManagerInterface
   */
  protected $webformElementManager;

  /**
   * @var EntityStorageInterface
   */
  protected $webformStorage;

  /**
   * Constructs a new WebformSubmissionViewsData object.
   *
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The entity type definition.
   * @param \Drupal\Core\Entity\Sql\SqlEntityStorageInterface $storage_controller
   *   The database storage controller.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager
   *   The entity type manager.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
   * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager
   *   The translation manager.
   * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
   *   The entity field manager.
   * @param \Drupal\Core\Entity\EntityTypeBundleInfo $entity_type_bundle_info
   *   The entity type bundle info.
   * @param \Drupal\webform\Plugin\WebformElementManagerInterface $webform_element_manager
   *   The webform element manager.
   * @param \Drupal\Core\Entity\EntityStorageInterface $webform_storage
   *   The webform entity storage.
   */
  public function __construct(
    EntityTypeInterface $entity_type,
    SqlEntityStorageInterface $storage_controller,
    EntityTypeManagerInterface $entity_manager,
    ModuleHandlerInterface $module_handler,
    TranslationInterface $translation_manager,
    EntityFieldManagerInterface $entity_field_manager,
    EntityTypeBundleInfo $entity_type_bundle_info,
    WebformElementManagerInterface $webform_element_manager,
    EntityStorageInterface $webform_storage
  ) {
    parent::__construct($entity_type, $storage_controller, $entity_manager, $module_handler, $translation_manager, $entity_field_manager, $entity_type_bundle_info);

    $this->webformElementManager = $webform_element_manager;
    $this->webformStorage = $webform_storage;
  }

  /**
   * {@inheritdoc}
   */
  public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
    return new static(
      $entity_type,
      $container->get('entity_type.manager')->getStorage($entity_type->id()),
      $container->get('entity_type.manager'),
      $container->get('module_handler'),
      $container->get('string_translation'),
      $container->get('entity_field.manager'),
      $container->get('entity_type.bundle.info'),
      $container->get('plugin.manager.webform.element'),
      $container->get('entity_type.manager')->getStorage('webform')
    );
  }
}

🐛 Bug report
Status

Closed: duplicate

Version

5.3

Component

Code

Created by

🇩🇪Germany k. tadesse

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

Comments & Activities

Production build 0.71.5 2024