A valid cache entry key is required. Use getAll() to get all table data

Created on 3 July 2024, 6 months ago
Updated 18 September 2024, 4 months ago

Problem/Motivation

A valid cache entry key is required. Use getAll() to get all table data. (core/modules/views/src/ViewsData.php:137)

Steps to reproduce

This happened on quite a few views, but probably the easiest way to reproduce is grabbing `admin_views`
Install the comment module

-> D7 Views broken - [View : admin_views_comment] - [Display : system_2] - filters -> title -> Relationship (nid) Not found in display.But found in default display.
[warning] Undefined array key "nid" HandlerBase.php:724
[warning] Trying to access array offset on value of type null HandlerBase.php:724
[warning] Trying to access array offset on value of type null HandlerBase.php:724
[error] A valid cache entry key is required. Use getAll() to get all table data. (/var/www/html/public/core/modules/views/src/ViewsData.php:137)

I am going to exclude that view from migrating but it should be easy to reproduce the error.

Proposed resolution

Default the cache entry key?

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇨🇦Canada joelpittet Vancouver

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

Comments & Activities

  • Issue created by @joelpittet
  • 🇮🇳India amitgoyal

    I am also facing the same issues.

    Based on the comment 🐛 A valid cache entry key is required. Use getAll() to get all table data. Closed: won't fix , I tried few patches from https://www.drupal.org/project/entity_reference_revisions/issues/2799479 🐛 Views doesn't recognize relationship to host Needs review but I am still getting the same issue.

  • 🇺🇸United States drpldrp San Francisco, CA

    Ran into this too.

    I compared the view config export between d7 and d10.3 and the field values were different:

    old:

    relationships:
      field_ref_author_target_id:
        id: field_ref_author_target_id
        table: node__field_ref_author
        field: field_ref_author_target_id
        relationship: none
        group_type: group
        admin_label: 'Content entity referenced from field_ref_author'
        plugin_id: standard
        required: false
        ui_name: ''
        label: 'Content entity referenced from field_ref_author'
        target_type: node
        field_name: field_ref_author
    

    new:

    relationships:
      field_ref_author:
        id: field_ref_author
        table: node__field_ref_author
        field: field_ref_author
        relationship: none
        group_type: group
        admin_label: 'field_ref_author: Content'
        plugin_id: standard
        required: false
    

    The patch sets field to field_name for relationships.

  • 🇺🇸United States drpldrp San Francisco, CA

    Here's an alternate patch that targets the MigrateViewsRelationship plugin specifically.

    Not really sure how the difference affects other types of relationships or which is considered better for inclusion.

    But it both seem to work for my use cases.

  • 🇺🇸United States drpldrp San Francisco, CA

    The changes in this commit https://git.drupalcode.org/project/views_migration/-/commit/2f3d58570609... are relevant to the config key value mismatches.

Production build 0.71.5 2024