RouteEntityUuidCacheContext

Created on 28 April 2023, over 1 year ago
Updated 25 October 2023, about 1 year ago

Hi guys,

First, thanks a lot for this great module, which is saving me a bunch of time. Just discovered a new edge case bug which led me to offer a new approach for RouteEntityUuidCacheContext. Issue is described below.

Problem/Motivation

On views routes, entities can't use the leverage of route entity autoloading and only their ids is passed. On view pages that leads to this issue: Error: Call to a member function bundle() on string in Drupal\notification_message\Cache\Context\RouteEntityUuidCacheContext->entitiesFromRoute() (line 88 of modules/contrib/notification_message/src/Cache/Context/RouteEntityUuidCacheContext.php).

Steps to reproduce

Install the module
Create a view with a context filter which provide a page, so the path looks like: your/view/%/with/arguments
Visit your/view/%/with/arguments

Proposed resolution

Digging this issue, I thought that taking an approach using the routeMatch would simplify the code and help us leverage route entity autoloading features.

I've rewritten the entitiesFromRoute() function.

πŸ› Bug report
Status

Fixed

Component

Code

Created by

πŸ‡­πŸ‡·Croatia Aporie

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

Comments & Activities

Production build 0.71.5 2024