Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
#2666798: Add a entity revision parameter converter & route enhancer introduced a generic entity revision parameter converter, so this could be leveraged by the node module.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#30 | 2678492-30.patch | 4.7 KB | kevin.dutra |
#28 | 2678492-28.patch | 4.59 KB | Steven Spasbo |
Comments
Comment #2
dawehnerComment #3
catchfwiw based on the discussion in #2678492: Convert the node revision converter to the generic entity one I'd be OK with the change in a minor release, but it feels like something for 8.2.x when that branch is open. That gives us plenty of time to revert or for affected modules to update if the theoretical API change turns out to be a real one.
Comment #6
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedLet's give this a try :)
Comment #7
dawehnerI just ask myself whether this is okay API break. Code on that page which uses
$route_match->getParameter('node_revision')
would now get an object instead of the ID.Comment #8
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedWell, if it's not ok, than this issue is won't fix.
Comment #9
dawehnerYeah, let's ask catch.
Comment #10
pfrenssenFixing this would break B/C, but leaving this unfixed breaks stuff too. This inconsistency is currently breaking contrib. OG has a context provider that loops over the entity link templates and resolves the entity from the route. This works great for all core routes, except for the node revision routes because they are not upcasting correctly, it gets a string ID where it expects an entity :(
Ref. https://github.com/Gizra/og/blob/8.x-1.x/src/OgRouteGroupResolverBase.ph...
Comment #11
pfrenssen@catch mentioned in comment #3 that he would be fine with this being fixed in a minor release. That's a very long time ago though. @catch can you confirm your comment or do we postpone until 9.0.0?
Comment #12
catchI still think it's OK to fix this, it's not part of the public API, and as #10 shows the existing behaviour breaks some expectations anyway.
Comment #15
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedSo.. given #12, I think we're good for RTBC here?
Comment #16
timmillwood@amateescu - yes, looks good to me!
Comment #18
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThe patch needed a reroll for the conversion to short array syntax.
Comment #19
dawehner+1 based upon #12
Comment #20
larowlanCan we get a change notice here? In particular pointing out the change to route match.
Comment #21
amateescu CreditAttribution: amateescu for Pfizer, Inc. commented@larowlan, not sure what you mean, which route match is changed by this patch?
Comment #22
larowlanSorry, see comment 7
Comment #23
jhedstromI just stumbled across this issue when I realized that the
node
parameter was not being converted to an object on the revision route. Can that also be addressed here, or should that be a new issue? That seemed like more of a bug to me since the route clearly defines{node}
in the path.The change to the patch to convert that to an object is as simple as:
Comment #24
jhedstromAdding the fix mentioned in #23 for now. This can be ignored if folks think a follow-up is better (and then 18 is still RTBC with a change notice).
Comment #25
hchonovI think as well that we should have a change notice about the route match parameter being entity now, but I don't consider it as BC break, because usually when a raw parameter is to be retrieved then one should use
\Drupal\Core\Routing\RouteMatchInterface::getRawParameter()
instead of\Drupal\Core\Routing\RouteMatchInterface::getParameter()
which by definition is returningthe processed value of a named route parameter
.Comment #28
Steven Spasbo CreditAttribution: Steven Spasbo at Workday, Inc. commentedComment #30
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commentedRe-roll for 8.8.x
Comment #32
apadernoComment #33
johnwebdev CreditAttribution: johnwebdev commentedAdded change record: https://www.drupal.org/node/3093408
Comment #35
jibranClosing this as a duplicate of #2730631: Upcast node and node_revision parameters of node revision routes as the patch there has test and issue has more followers as well. I'll transfer the credit from here over there.
Comment #36
jibranMarking change notice as duplicate as well of https://www.drupal.org/node/2942013.