Event.php data_table annotation breaks views in 10.1

Created on 22 April 2024, 2 months ago
Updated 2 May 2024, about 2 months ago

Problem/Motivation

After updating to version 10.1 of the bat module, the relationship in some of my views broke. I get errors about broken/missing handlers in the view fields and relationships. I tracked the reason down to being that the line

*   data_table = "bat_event__event_dates",

was added to the annotation of Drupal\bat_event\Entity\Event.php in the last commit to 10.1. If I remove this new line from the annotation my views work as before. If I keep the line my views break. I also noticed that I'm only able to create a relationship to a User entity if I leave the line in the annotation:

but if I remove the line, I have access to many more relationship links. Some of them come from fields I've configured on other entities, but some also seem to come from the core of BAT (unit reference, event state, event series, booking):

Steps to reproduce

  1. Install BAT 10.1, leave the "data_table" line in the annotation
  2. Create a blank view targeting Event entities of type availability_hourly or availability_daily. Add a page or block to the view.
  3. Under the advanced section, click create relationship. Note the nr of relationships available (only User relationship should be available).
  4. Cancel out of the dialog
  5. Remove the data_table line from the annotation of Drupal\bat_event\Entity\Event.php, clear/refresh Drupal cache.
  6. In the view editor, again click create relationship. Note that the nr of available relationships has changed (there should now be more relationships available).

Any idea why this happens? It seems somehow the link to the other tables (bat_event__event_bat_unit_reference, bat_event__event_state_reference, etc) in the database is lost when the data_table line is added, but I have no idea why.

🐛 Bug report
Status

Active

Version

10.1

Component

Code

Created by

🇫🇮Finland jwwj

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

Comments & Activities

  • Issue created by @jwwj
  • 🇮🇹Italy maurizio.ganovelli Arezzo

    I have a problem that seems related to this. After updating BAT module from rc to stable 10.1 version, viewing a commerce order (from backoffice) i get this error:

    InvalidArgumentException: A valid cache entry key is required. Use getAll() to get all table data. in Drupal\views\ViewsData->get() (linea 137 di /app/web/core/modules/views/src/ViewsData.php).

    removing the line "data_table" in annotation and clearing caches, view seems to work normally.

Production build 0.69.0 2024