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
- Install BAT 10.1, leave the "data_table" line in the annotation
- Create a blank view targeting Event entities of type availability_hourly or availability_daily. Add a page or block to the view.
- Under the advanced section, click create relationship. Note the nr of relationships available (only User relationship should be available).
- Cancel out of the dialog
- Remove the data_table line from the annotation of Drupal\bat_event\Entity\Event.php, clear/refresh Drupal cache.
- 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.
| Comment | File | Size | Author |
|---|---|---|---|
| Screenshot 2024-04-22 at 15.17.53.png | 250.57 KB | jwwj | |
| Screenshot 2024-04-22 at 15.17.06.png | 49.76 KB | jwwj |
Comments
Comment #2
maurizio.ganovelliI 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 (i have a view with a block display with data from booked resource inside an order pane):
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.
Comment #3
majdi commentedI think that change would require a hook update, and I did not see any hook update in https://git.drupalcode.org/project/bat/-/commit/142a12a002ed39a190428a9b...
Potential Side Effects:
Data Inconsistency: Entity records should be moved to bat_event__event_dates. Also existing views or custom queries depend on the old table structure may break or return incomplete results.
Comment #5
afagioli* data_table = "bat_event__event_dates"removed in latest devComment #6
afagioliApplied with https://www.drupal.org/project/bat/releases/8.x-10.2
Comment #7
afagioliComment #8
afagioli