Problem/Motivation
EventInstances::computeValue() generates an item list keyed by event instance entity IDs. This means that $event_series->event_instances->referencedEntities() doesn't conform to the expectations for the return value of EntityReferenceFieldItemListInterface::referencedEntities(), which is supposed to be "An array of entity objects keyed by field item deltas." This in turn breaks any code that expects the first instance to be delta 0; e.g., $event_series->event_instances->referencedEntities()[0]->label().
Proposed resolution
Change EventInstances::computeValue() to return an array with standard delta keys (0, 1, ...), sorted by instance start date.
Issue fork recurring_events-3320512
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
muriqui commentedProposed fix in MR !57 (including a couple of coding standards fixes in EventInstances.php).
Comment #7
owenbush commentedThanks for this issue, I checked through the code to ensure there were no expectations of data being keyed by eventinstance_id and it looked like there weren't, so I have merged this into the latest dev branches for 8.x-1.x and 2.0.x