Call to mapSingleFieldViewsData() missing $data argument

Created on 1 October 2024, 3 months ago

Problem/Motivation

When trying to enable the log module β†’ which has this module as a requirement I got error:

PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Drupal\views\EntityViewsData::mapSingleFieldViewsData(), 7 passed in /var/www/html/docroot/modules/contrib/entity/src/EntityViewsData.php on line 185 and exactly 8 expected in /var/www/html/docroot/core/modules/views/src/EntityViewsData.php:484
Stack trace:
#0 /var/www/html/docroot/modules/contrib/entity/src/EntityViewsData.php(185): Drupal\views\EntityViewsData->mapSingleFieldViewsData('log', 'uuid', 'uuid', 'value', 'varchar_ascii', true, Object(Drupal\Core\Field\BaseFieldDefinition))

Looking at core/modules/views/src/EntityViewsData.php I can see:

protected function mapSingleFieldViewsData($table, $field_name, $field_type, $column_name, $column_type, $first, FieldDefinitionInterface $field_definition, array &$data) {

And in modules/contrib/entity/src/EntityViewsData.php:185 I can see:

$table_data[$schema_field_name] = $this->mapSingleFieldViewsData($table, $field_name, $field_definition_type, $field_column_name, $field_schema['columns'][$field_column_name]['type'], $first, $field_definition);

This this needs to be updated to pass the $data argument with a reference to all the views data.

Steps to reproduce

drush en log
πŸ› Bug report
Status

Active

Version

1.0

Component

Core integration

Created by

πŸ‡¬πŸ‡§United Kingdom dahousecat

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

Comments & Activities

  • Issue created by @dahousecat
  • πŸ‡¬πŸ‡§United Kingdom dahousecat
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Looking at core/modules/views/src/EntityViewsData.php I can see:

    protected function mapSingleFieldViewsData($table, $field_name, $field_type, $column_name, $column_type, $first, FieldDefinitionInterface $field_definition, array &$data) {
    

    The error message says is defined on line 484.

    That is not what I see. The current version of Drupal 11 defines that method at line 479, with no $data parameter.
    The 10.3.5 version of Drupal also defines that method at line 479, with no $data parameter.

    What version of Drupal are you using? And are you sure you don't have a core patch applied?

Production build 0.71.5 2024