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
Follow up to #2853460-25: Simplify RequestHandler: make it no longer ContainerAware, split up ::handle()
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#20 | 2935783-20.patch | 6.65 KB | Wim Leers |
#20 | interdiff-18-20.txt | 785 bytes | Wim Leers |
#18 | resource-handle-args-2935783.5.patch | 6.65 KB | larowlan |
#18 | interdiff-79c41f.txt | 872 bytes | larowlan |
#15 | resource-handle-args-2935783.4.patch | 6.61 KB | larowlan |
Comments
Comment #2
larowlanI might be making this up
Comment #3
Wim LeersSo: you're saying that
handle()
should haveRestResourceConfigInterface $rest_resource_config
as one of its parameters, and then the routing system should do the upcasting automatically. Correct?EDIT: cross-posted — looks like that is what @larowlan meant.
Comment #4
Wim LeersOh, even without the upcasting!
Comment #5
larowlanWe might need a named slug for this to work, we'll see. Could be dreaming this up.
If it works, would be interested to see if we could make it use the entity converter too by setting the needed options, then we can avoid the ::load
Comment #6
Wim LeersLove the thinking, doubt it works, would love to be wrong, will check in the morning!
Comment #8
larowlanso it works, next step, adding the entity type options and making it use the actual config entity
Comment #9
Wim LeersWoahhhhh! TIL. 👌
Comment #10
Wim LeersOnly fixed a docs nit.
So this doesn't do upcasting, but it does mean there's no more need to inspect the route match's matched route object just to read a route default. Still a win :) One LoC less!
Comment #11
Wim LeersOops.
Comment #12
larowlani think we can do better, will need to update the kernel test still (doesn't include #10 yet)
Comment #14
Wim Leers#12 is what I thought you originally meant, and what I thought that couldn't work.
Looks like it doesn't. 100% of REST integration tests fail with:
Comment #15
larowlanMessed up #12
Comment #16
larowlanthis was my mistake
Comment #18
larowlanwinning
Comment #19
larowlansweet
Comment #20
Wim LeersVery happy to be wrong! 😀
And great to have an example in core of how to get a route default to be upcasted!
Only bringing back my nitpick fixes from #10, then this is RTBC.
Comment #23
larowlanl.d.o http transfer issues
Comment #24
Wim LeersIndeed! Retesting…
Comment #25
catchJust saw this yesterday and thought it looked a bit clunky, then saw this issue today.
Committed/pushed to 8.6.x and cherry-picked to 8.5.x. Thanks!
Comment #28
catch